frames: Ignore GdkX11 deprecations
The entire X11 backend was deprecated, to indicate its planned removal in GTK5. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4352>
This commit is contained in:
parent
cb4d8e9aa7
commit
48e35f5500
@ -111,7 +111,9 @@ main (int argc,
|
||||
if (should_load_libadwaita ())
|
||||
load_libadwaita ();
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
XFixesSetClientDisconnectMode (xdisplay,
|
||||
XFixesClientDisconnectFlagTerminate);
|
||||
|
||||
|
@ -74,6 +74,8 @@ client_window_has_wm_protocol (MetaFrame *frame,
|
||||
unsigned long i, nitems, bytes_after;
|
||||
gboolean found = FALSE;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
wm_protocols_atom =
|
||||
@ -95,6 +97,8 @@ client_window_has_wm_protocol (MetaFrame *frame,
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return FALSE;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
if (wm_protocols[i] == protocol)
|
||||
@ -126,6 +130,8 @@ on_frame_close_request (GtkWindow *window,
|
||||
client_xwindow =
|
||||
meta_frame_content_get_window (META_FRAME_CONTENT (content));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
delete_window_atom =
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW");
|
||||
|
||||
@ -154,6 +160,8 @@ on_frame_close_request (GtkWindow *window,
|
||||
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -176,6 +184,8 @@ update_extents (MetaFrame *frame,
|
||||
data[2] = border.top;
|
||||
data[3] = border.bottom;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xframe = gdk_x11_surface_get_xid (surface);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
@ -190,6 +200,8 @@ update_extents (MetaFrame *frame,
|
||||
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
frame->extents = border;
|
||||
}
|
||||
|
||||
@ -205,6 +217,8 @@ get_utf8_string_prop (GtkWindow *window,
|
||||
Atom type;
|
||||
unsigned long nitems, bytes_after;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
@ -226,6 +240,8 @@ get_utf8_string_prop (GtkWindow *window,
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -280,7 +296,9 @@ text_property_to_utf8 (GdkDisplay *display,
|
||||
int count = 0;
|
||||
int res;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
res = XmbTextPropertyToTextList (xdisplay, prop,
|
||||
&local_list, &count);
|
||||
@ -311,6 +329,8 @@ frame_sync_wm_name (GtkWindow *window,
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
retval = XGetWMName (gdk_x11_display_get_xdisplay (display),
|
||||
@ -319,6 +339,9 @@ frame_sync_wm_name (GtkWindow *window,
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (retval == 0)
|
||||
return;
|
||||
|
||||
@ -341,6 +364,8 @@ frame_sync_motif_wm_hints (GtkWindow *window,
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
if (XGetWindowProperty (gdk_x11_display_get_xdisplay (display),
|
||||
@ -359,6 +384,8 @@ frame_sync_motif_wm_hints (GtkWindow *window,
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (mwm_hints &&
|
||||
(mwm_hints->flags & MWM_HINTS_FUNCTIONS) != 0)
|
||||
{
|
||||
@ -383,6 +410,8 @@ frame_sync_wm_normal_hints (GtkWindow *frame,
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
if (!XGetWMNormalHints (gdk_x11_display_get_xdisplay (display),
|
||||
@ -397,6 +426,8 @@ frame_sync_wm_normal_hints (GtkWindow *frame,
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (nitems > 0)
|
||||
{
|
||||
resizable = ((size_hints.flags & PMinSize) == 0 ||
|
||||
@ -413,11 +444,14 @@ frame_sync_wm_state (MetaFrame *frame,
|
||||
Window client_window)
|
||||
{
|
||||
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
Display *xdisplay;
|
||||
Atom *data = NULL, type;
|
||||
int format;
|
||||
unsigned long i, nitems, bytes_after;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
XGetWindowProperty (xdisplay,
|
||||
@ -437,6 +471,8 @@ frame_sync_wm_state (MetaFrame *frame,
|
||||
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
XFree (data);
|
||||
}
|
||||
|
||||
@ -448,6 +484,8 @@ meta_frame_constructed (GObject *object)
|
||||
|
||||
display = gtk_widget_get_display (GTK_WIDGET (object));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
frame->atom__NET_WM_VISIBLE_NAME =
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_VISIBLE_NAME");
|
||||
frame->atom__NET_WM_NAME =
|
||||
@ -459,6 +497,8 @@ meta_frame_constructed (GObject *object)
|
||||
frame->atom__NET_WM_STATE_FULLSCREEN =
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN");
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
G_OBJECT_CLASS (meta_frame_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
@ -553,7 +593,9 @@ meta_frame_new (Window window)
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (frame));
|
||||
surface = gtk_native_get_surface (GTK_NATIVE (frame));
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gdk_x11_surface_set_frame_sync_enabled (surface, TRUE);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
frame_sync_wm_state (META_FRAME (frame), window);
|
||||
|
||||
@ -579,9 +621,11 @@ meta_frame_new (Window window)
|
||||
/* Disable XDND support on the frame window, because it can cause some clients
|
||||
* to try use it instead of the client window as drop target */
|
||||
display = gtk_widget_get_display (GTK_WIDGET (frame));
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
XDeleteProperty (gdk_x11_display_get_xdisplay (display),
|
||||
gdk_x11_surface_get_xid (surface),
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "XdndAware"));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
return frame;
|
||||
}
|
||||
@ -603,7 +647,9 @@ meta_frame_handle_xevent (MetaFrame *frame,
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
is_frame = window == gdk_x11_surface_get_xid (surface);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
is_content =
|
||||
window == meta_frame_content_get_window (META_FRAME_CONTENT (content));
|
||||
|
||||
|
@ -119,7 +119,7 @@ set_up_frame (MetaWindowTracker *window_tracker,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkDisplay *display = window_tracker->display;
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
Display *xdisplay;
|
||||
GdkSurface *surface;
|
||||
Window xframe;
|
||||
unsigned long data[1];
|
||||
@ -130,11 +130,14 @@ set_up_frame (MetaWindowTracker *window_tracker,
|
||||
GUINT_TO_POINTER (xwindow)))
|
||||
return;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Create a frame window */
|
||||
frame = meta_frame_new (xwindow);
|
||||
surface = gtk_native_get_surface (GTK_NATIVE (frame));
|
||||
xframe = gdk_x11_surface_get_xid (surface);
|
||||
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
XAddToSaveSet (xdisplay, xwindow);
|
||||
@ -154,6 +157,8 @@ set_up_frame (MetaWindowTracker *window_tracker,
|
||||
return;
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_hash_table_insert (window_tracker->frames,
|
||||
GUINT_TO_POINTER (xframe), frame);
|
||||
g_hash_table_insert (window_tracker->client_windows,
|
||||
@ -166,12 +171,15 @@ listen_set_up_frame (MetaWindowTracker *window_tracker,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkDisplay *display = window_tracker->display;
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
Display *xdisplay;
|
||||
int format;
|
||||
Atom type;
|
||||
unsigned long nitems, bytes_after;
|
||||
unsigned char *data;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
XSelectInput (xdisplay, xwindow,
|
||||
@ -190,6 +198,8 @@ listen_set_up_frame (MetaWindowTracker *window_tracker,
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (nitems > 0 && data[0])
|
||||
set_up_frame (window_tracker, xwindow);
|
||||
|
||||
@ -201,7 +211,7 @@ remove_frame (MetaWindowTracker *window_tracker,
|
||||
Window xwindow)
|
||||
{
|
||||
GdkDisplay *display = window_tracker->display;
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
Display *xdisplay;
|
||||
GtkWidget *frame;
|
||||
GdkSurface *surface;
|
||||
Window xframe;
|
||||
@ -211,6 +221,10 @@ remove_frame (MetaWindowTracker *window_tracker,
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
|
||||
surface = gtk_native_get_surface (GTK_NATIVE (frame));
|
||||
xframe = gdk_x11_surface_get_xid (surface);
|
||||
|
||||
@ -218,6 +232,8 @@ remove_frame (MetaWindowTracker *window_tracker,
|
||||
XRemoveFromSaveSet (xdisplay, xwindow);
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_hash_table_remove (window_tracker->client_windows,
|
||||
GUINT_TO_POINTER (xwindow));
|
||||
g_hash_table_remove (window_tracker->frames,
|
||||
@ -229,11 +245,15 @@ on_xevent (GdkDisplay *display,
|
||||
XEvent *xevent,
|
||||
gpointer user_data)
|
||||
{
|
||||
Window xroot = gdk_x11_display_get_xrootwindow (display);
|
||||
Window xroot;
|
||||
Window xwindow = xevent->xany.window;
|
||||
MetaWindowTracker *window_tracker = user_data;
|
||||
GtkWidget *frame;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xroot = gdk_x11_display_get_xrootwindow (display);
|
||||
|
||||
if (xevent->type == CreateNotify &&
|
||||
xevent->xcreatewindow.parent == xroot &&
|
||||
!xevent->xcreatewindow.override_redirect &&
|
||||
@ -303,6 +323,7 @@ on_xevent (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
@ -332,13 +353,18 @@ meta_window_tracker_constructed (GObject *object)
|
||||
{
|
||||
MetaWindowTracker *window_tracker = META_WINDOW_TRACKER (object);
|
||||
GdkDisplay *display = window_tracker->display;
|
||||
Display *xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
Window xroot = gdk_x11_display_get_xrootwindow (display);
|
||||
Display *xdisplay;
|
||||
Window xroot;
|
||||
Window *windows, ignored1, ignored2;
|
||||
unsigned int i, n_windows;
|
||||
|
||||
G_OBJECT_CLASS (meta_window_tracker_parent_class)->constructed (object);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
xdisplay = gdk_x11_display_get_xdisplay (display);
|
||||
xroot = gdk_x11_display_get_xrootwindow (display);
|
||||
|
||||
query_xi_extension (window_tracker, xdisplay);
|
||||
|
||||
XSelectInput (xdisplay, xroot,
|
||||
@ -382,6 +408,8 @@ meta_window_tracker_constructed (GObject *object)
|
||||
listen_set_up_frame (window_tracker, windows[i]);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
XFree (windows);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user