x11: Introduce a meta-x11-types header
Used to define x11 only types. Future commits will introduce a way for compositors to detect if they can use x11 features or not Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3776>
This commit is contained in:
parent
50058b79d1
commit
0814d5029d
16 changed files with 62 additions and 22 deletions
|
@ -24,6 +24,7 @@
|
|||
#ifdef HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include "compositor/meta-compositor-x11.h"
|
||||
#include "meta/meta-x11-types.h"
|
||||
#endif
|
||||
|
||||
#include "backends/meta-backend-private.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-input-device-x11.h"
|
||||
#include "core/display-private.h"
|
||||
#include "meta/meta-x11-display.h"
|
||||
#include "mtk/mtk-x11.h"
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -65,6 +65,12 @@ typedef enum
|
|||
typedef void (* MetaDisplayWindowFunc) (MetaWindow *window,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
/* To avoid ifdefing MetaX11Display usage when built without X11 support */
|
||||
#ifndef HAVE_X11_CLIENT
|
||||
typedef struct MetaX11Display MetaX11Display;
|
||||
#endif
|
||||
|
||||
struct _MetaDisplay
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
|
|
@ -927,6 +927,7 @@ on_x11_initialized (MetaDisplay *display,
|
|||
}
|
||||
#endif /* HAVE_XWAYLAND */
|
||||
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
void
|
||||
meta_display_shutdown_x11 (MetaDisplay *display)
|
||||
{
|
||||
|
@ -939,6 +940,7 @@ meta_display_shutdown_x11 (MetaDisplay *display)
|
|||
g_clear_object (&display->x11_display);
|
||||
meta_stack_thaw (display->stack);
|
||||
}
|
||||
#endif
|
||||
|
||||
MetaDisplay *
|
||||
meta_display_new (MetaContext *context,
|
||||
|
@ -969,7 +971,9 @@ meta_display_new (MetaContext *context,
|
|||
display->autoraise_window = NULL;
|
||||
display->focus_window = NULL;
|
||||
display->workspace_manager = NULL;
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
display->x11_display = NULL;
|
||||
#endif
|
||||
|
||||
display->current_cursor = -1; /* invalid/unset */
|
||||
display->check_fullscreen_later = 0;
|
||||
|
@ -1282,7 +1286,9 @@ meta_display_close (MetaDisplay *display,
|
|||
meta_stack_tracker_free);
|
||||
|
||||
g_clear_pointer (&display->compositor, meta_compositor_destroy);
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
meta_display_shutdown_x11 (display);
|
||||
#endif
|
||||
g_clear_object (&display->stack);
|
||||
|
||||
/* Must be after all calls to meta_window_unmanage() since they
|
||||
|
@ -2584,17 +2590,6 @@ meta_display_get_compositor (MetaDisplay *display)
|
|||
return display->compositor;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_get_x11_display: (skip)
|
||||
* @display: a #MetaDisplay
|
||||
*
|
||||
*/
|
||||
MetaX11Display *
|
||||
meta_display_get_x11_display (MetaDisplay *display)
|
||||
{
|
||||
return display->x11_display;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_get_size:
|
||||
* @display: A #MetaDisplay
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
#include "core/meta-accel-parse.h"
|
||||
#include "meta/keybindings.h"
|
||||
#ifdef HAVE_X11
|
||||
#include "meta/meta-x11-types.h"
|
||||
#endif
|
||||
|
||||
typedef struct _MetaKeyHandler MetaKeyHandler;
|
||||
struct _MetaKeyHandler
|
||||
|
|
|
@ -80,8 +80,6 @@ typedef struct _MetaDisplayClass MetaDisplayClass;
|
|||
META_EXPORT
|
||||
GType meta_display_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
|
||||
|
||||
META_EXPORT
|
||||
void meta_display_close (MetaDisplay *display,
|
||||
guint32 timestamp);
|
||||
|
@ -92,9 +90,6 @@ MetaContext * meta_display_get_context (MetaDisplay *display);
|
|||
META_EXPORT
|
||||
MetaCompositor *meta_display_get_compositor (MetaDisplay *display);
|
||||
|
||||
META_EXPORT
|
||||
MetaX11Display *meta_display_get_x11_display (MetaDisplay *display);
|
||||
|
||||
META_EXPORT
|
||||
MetaWindow *meta_display_get_focus_window (MetaDisplay *display);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "meta/common.h"
|
||||
#include "meta/types.h"
|
||||
#include "meta/meta-x11-types.h"
|
||||
|
||||
/* note, can return NULL */
|
||||
META_EXPORT
|
||||
|
|
|
@ -58,9 +58,10 @@ if have_wayland
|
|||
]
|
||||
endif
|
||||
|
||||
if have_x11
|
||||
if have_x11_client
|
||||
mutter_public_headers += [
|
||||
'meta-x11-display.h',
|
||||
'meta-x11-types.h',
|
||||
]
|
||||
endif
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include "meta/common.h"
|
||||
#include "meta/prefs.h"
|
||||
#include "meta/types.h"
|
||||
#include "meta/meta-x11-types.h"
|
||||
|
||||
#define meta_XFree(p) do { if ((p)) XFree ((p)); } while (0)
|
||||
|
||||
typedef void (* MetaX11DisplayEventFunc) (MetaX11Display *x11_display,
|
||||
XEvent *xev,
|
||||
|
@ -63,3 +66,6 @@ void meta_x11_display_redirect_windows (MetaX11Display *x11_display,
|
|||
META_EXPORT
|
||||
Window meta_x11_display_lookup_xwindow (MetaX11Display *x11_display,
|
||||
MetaWindow *window);
|
||||
|
||||
META_EXPORT
|
||||
MetaX11Display * meta_display_get_x11_display (MetaDisplay *display);
|
||||
|
|
21
src/meta/meta-x11-types.h
Normal file
21
src/meta/meta-x11-types.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2024 Bilal Elmoussaoui
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef struct _MetaX11Display MetaX11Display;
|
||||
typedef struct _MetaGroup MetaGroup;
|
|
@ -23,12 +23,10 @@ typedef struct _MetaBackend MetaBackend;
|
|||
typedef struct _MetaContext MetaContext;
|
||||
typedef struct _MetaCompositor MetaCompositor;
|
||||
typedef struct _MetaDisplay MetaDisplay;
|
||||
typedef struct _MetaX11Display MetaX11Display;
|
||||
typedef struct _MetaWindow MetaWindow;
|
||||
typedef struct _MetaWorkspace MetaWorkspace;
|
||||
typedef struct _MetaLaters MetaLaters;
|
||||
|
||||
typedef struct _MetaGroup MetaGroup;
|
||||
typedef struct _MetaKeyBinding MetaKeyBinding;
|
||||
typedef struct _MetaCursorTracker MetaCursorTracker;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <gio/gsettingsbackend.h>
|
||||
|
||||
#include "core/meta-context-private.h"
|
||||
#include "meta/meta-x11-display.h"
|
||||
#include "tests/meta-backend-test.h"
|
||||
#include "tests/meta-test-shell.h"
|
||||
#include "tests/meta-test-utils-private.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "backends/meta-virtual-monitor.h"
|
||||
#include "meta/meta-x11-types.h"
|
||||
#include "meta/window.h"
|
||||
|
||||
#define META_TEST_CLIENT_ERROR meta_test_client_error_quark ()
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "meta/display.h"
|
||||
#include "meta/meta-x11-display.h"
|
||||
|
||||
void meta_x11_display_init_events (MetaX11Display *x11_display);
|
||||
void meta_x11_display_free_events (MetaX11Display *x11_display);
|
||||
|
|
|
@ -2572,3 +2572,14 @@ meta_x11_display_lookup_xwindow (MetaX11Display *x11_display,
|
|||
|
||||
return None;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_display_get_x11_display: (skip)
|
||||
* @display: a #MetaDisplay
|
||||
*
|
||||
*/
|
||||
MetaX11Display *
|
||||
meta_display_get_x11_display (MetaDisplay *display)
|
||||
{
|
||||
return display->x11_display;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/sync.h>
|
||||
|
||||
#include "meta/display.h"
|
||||
#include "meta/meta-x11-display.h"
|
||||
|
||||
/* Copied from Lesstif by way of GTK. Rudimentary docs can be
|
||||
* found in some Motif reference guides online.
|
||||
|
|
Loading…
Reference in a new issue