Switch meta_error_trap functions to MetaX11Display

They are X11 specific functions, used for X11 code. They have been
improved per jadahl's suggestion to use gdk_x11_lookup_xdisplay and
gdk_x11_display_error_trap_* functions, instead of current code.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Armin Krezović 2017-08-26 18:27:50 +02:00 committed by Jonas Ådahl
parent 18779109de
commit dacc041d0c
21 changed files with 185 additions and 170 deletions

View File

@ -63,9 +63,9 @@ device_free_xdevice (gpointer user_data)
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdev = user_data;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XCloseDevice (xdisplay, xdev);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
static XDevice *
@ -81,9 +81,9 @@ device_ensure_xdevice (ClutterInputDevice *device)
if (xdev)
return xdev;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
xdev = XOpenDevice (xdisplay, device_id);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
if (xdev)
{
@ -586,7 +586,7 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
return;
/* Grab the puke bucket! */
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
xdev = device_ensure_xdevice (device);
if (xdev)
{
@ -595,7 +595,7 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
Absolute : Relative);
}
if (meta_error_trap_pop_with_return (display))
if (meta_error_trap_pop_with_return (display->x11_display))
{
g_warning ("Could not set tablet mapping for %s",
clutter_input_device_get_device_name (device));
@ -782,7 +782,7 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
return;
/* Grab the puke bucket! */
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
xdev = device_ensure_xdevice (device);
if (xdev)
{
@ -800,7 +800,7 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
XSetDeviceButtonMapping (xdisplay, xdev, map, G_N_ELEMENTS (map));
}
if (meta_error_trap_pop_with_return (display))
if (meta_error_trap_pop_with_return (display->x11_display))
{
g_warning ("Could not set stylus button map for %s",
clutter_input_device_get_device_name (device));

View File

@ -470,11 +470,11 @@ redirect_windows (MetaScreen *screen)
*/
while (TRUE)
{
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
XSync (xdisplay, FALSE);
if (!meta_error_trap_pop_with_return (display))
if (!meta_error_trap_pop_with_return (x11_display))
break;
if (n_retries == max_retries)
@ -662,12 +662,12 @@ meta_compositor_add_window (MetaCompositor *compositor,
{
MetaDisplay *display = compositor->display;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
meta_window_actor_new (window);
sync_actor_stacking (compositor);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
void

View File

@ -74,10 +74,10 @@ free_damage (MetaSurfaceActorX11 *self)
if (priv->damage == None)
return;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XDamageDestroy (xdisplay, priv->damage);
priv->damage = None;
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
static void
@ -98,10 +98,10 @@ detach_pixmap (MetaSurfaceActorX11 *self)
meta_shaped_texture_set_texture (stex, NULL);
cogl_flush ();
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XFreePixmap (xdisplay, priv->pixmap);
priv->pixmap = None;
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
g_clear_pointer (&priv->texture, cogl_object_unref);
}
@ -152,10 +152,10 @@ update_pixmap (MetaSurfaceActorX11 *self)
Pixmap new_pixmap;
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (display->x11_display) != Success)
{
/* Probably a BadMatch if the window isn't viewable; we could
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
@ -228,9 +228,9 @@ meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
if (priv->received_damage)
{
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XDamageSubtract (xdisplay, priv->damage, None, None);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
priv->received_damage = FALSE;
}
@ -315,7 +315,7 @@ sync_unredirected (MetaSurfaceActorX11 *self)
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
if (priv->unredirected)
{
@ -327,7 +327,7 @@ sync_unredirected (MetaSurfaceActorX11 *self)
XCompositeRedirectWindow (xdisplay, xwindow, CompositeRedirectManual);
}
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
static void

View File

@ -1990,10 +1990,10 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT(0xffffffff);
ev.data.l[3] = frame->frame_drawn_time >> 32;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
XFlush (xdisplay);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
void
@ -2067,10 +2067,10 @@ do_send_frame_timings (MetaWindowActor *self,
ev.data.l[3] = refresh_interval;
ev.data.l[4] = 1000 * META_SYNC_DELAY;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
XFlush (xdisplay);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
static void

View File

@ -1534,7 +1534,7 @@ request_xserver_input_focus_change (MetaDisplay *display,
if (meta_display_timestamp_too_old (display, &timestamp))
return;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
/* In order for mutter to know that the focus request succeeded, we track
* the serial of the "focus request" we made, but if we take the serial
@ -1567,7 +1567,7 @@ request_xserver_input_focus_change (MetaDisplay *display,
serial,
TRUE);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
display->last_focus_time = timestamp;
@ -2091,13 +2091,13 @@ meta_display_update_active_window_hint (MetaDisplay *display)
else
data[0] = None;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XChangeProperty (display->x11_display->xdisplay,
display->x11_display->xroot,
display->x11_display->atom__NET_ACTIVE_WINDOW,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
void

View File

@ -26,10 +26,10 @@
#include <config.h>
#include <meta/errors.h>
#include "display-private.h"
#include <errno.h>
#include <stdlib.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include "x11/meta-x11-display-private.h"
/* In GTK+-3.0, the error trapping code was significantly rewritten. The new code
* has some neat features (like knowing automatically if a sync is needed or not
@ -44,19 +44,34 @@
*/
void
meta_error_trap_push (MetaDisplay *display)
meta_error_trap_push (MetaX11Display *x11_display)
{
gdk_error_trap_push ();
GdkDisplay *gdk_display;
gdk_display = gdk_x11_lookup_xdisplay (x11_display->xdisplay);
g_assert (gdk_display != NULL);
gdk_x11_display_error_trap_push (gdk_display);
}
void
meta_error_trap_pop (MetaDisplay *display)
meta_error_trap_pop (MetaX11Display *x11_display)
{
gdk_error_trap_pop_ignored ();
GdkDisplay *gdk_display;
gdk_display = gdk_x11_lookup_xdisplay (x11_display->xdisplay);
g_assert (gdk_display != NULL);
gdk_x11_display_error_trap_pop_ignored (gdk_display);
}
int
meta_error_trap_pop_with_return (MetaDisplay *display)
meta_error_trap_pop_with_return (MetaX11Display *x11_display)
{
return gdk_error_trap_pop ();
GdkDisplay *gdk_display;
gdk_display = gdk_x11_lookup_xdisplay (x11_display->xdisplay);
g_assert (gdk_display != NULL);
return gdk_x11_display_error_trap_pop (gdk_display);
}

View File

@ -87,7 +87,7 @@ meta_window_ensure_frame (MetaWindow *window)
meta_display_register_x_window (window->display, &frame->xwindow, window);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
if (window->mapped)
{
window->mapped = FALSE; /* the reparent will unmap the window,
@ -107,7 +107,7 @@ meta_window_ensure_frame (MetaWindow *window)
frame->child_x,
frame->child_y);
/* FIXME handle this error */
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
/* stick frame to the window */
window->frame = frame;
@ -174,7 +174,7 @@ meta_window_destroy_frame (MetaWindow *window)
/* Unparent the client window; it may be destroyed,
* thus the error trap.
*/
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
if (window->mapped)
{
window->mapped = FALSE; /* Keep track of unmapping it, so we
@ -197,7 +197,7 @@ meta_window_destroy_frame (MetaWindow *window)
*/
window->frame->rect.x + borders.invisible.left,
window->frame->rect.y + borders.invisible.top);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
meta_ui_frame_unmanage (frame->ui_frame);

View File

@ -3065,7 +3065,7 @@ handle_panel (MetaDisplay *display,
"off due to keybinding press\n", event->time);
display->mouse_mode = FALSE;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
/* Release the grab for the panel before sending the event */
XUngrabKeyboard (x11_display->xdisplay, event->time);
@ -3076,7 +3076,7 @@ handle_panel (MetaDisplay *display,
StructureNotifyMask,
(XEvent*) &ev);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
}
static void

View File

@ -582,10 +582,10 @@ take_manager_selection (MetaDisplay *display,
if (should_replace)
{
/* We want to find out when the current selection owner dies */
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
attrs.event_mask = StructureNotifyMask;
XChangeWindowAttributes (x11_display->xdisplay, current_owner, CWEventMask, &attrs);
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
current_owner = None; /* don't wait for it to die later on */
}
else
@ -970,13 +970,13 @@ set_number_of_spaces_hint (MetaScreen *screen,
meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu\n", data[0]);
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_NUMBER_OF_DESKTOPS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
}
static void
@ -993,13 +993,13 @@ set_desktop_geometry_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu\n", data[0], data[1]);
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_DESKTOP_GEOMETRY,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
}
static void
@ -1019,13 +1019,13 @@ set_desktop_viewport_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_DESKTOP_VIEWPORT to 0, 0\n");
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_DESKTOP_VIEWPORT,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
}
void
@ -1785,14 +1785,14 @@ set_workspace_names (MetaScreen *screen)
++i;
}
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_DESKTOP_NAMES,
x11_display->atom_UTF8_STRING,
8, PropModeReplace,
(unsigned char *)flattened->str, flattened->len);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
g_string_free (flattened, TRUE);
}
@ -1860,14 +1860,14 @@ set_work_area_hint (MetaScreen *screen)
tmp += 4;
}
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_WORKAREA,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, num_workspaces*4);
g_free (data);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
g_signal_emit (screen, screen_signals[WORKAREAS_CHANGED], 0);
}
@ -2262,13 +2262,13 @@ meta_screen_update_showing_desktop_hint (MetaScreen *screen)
data[0] = screen->active_workspace->showing_desktop ? 1 : 0;
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_SHOWING_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
}
static void
@ -2626,13 +2626,13 @@ meta_screen_set_active_workspace_hint (MetaScreen *screen)
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
meta_error_trap_push (screen->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
meta_error_trap_pop (x11_display);
}
static gboolean

View File

@ -990,7 +990,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
{
serial = XNextRequest (x11_display->xdisplay);
meta_error_trap_push (tracker->screen->display);
meta_error_trap_push (x11_display);
changes.stack_mode = changes.sibling ? Below : Above;
@ -999,7 +999,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
meta_error_trap_pop (tracker->screen->display);
meta_error_trap_pop (x11_display);
}
}
@ -1025,7 +1025,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
{
serial = XNextRequest (x11_display->xdisplay);
meta_error_trap_push (tracker->screen->display);
meta_error_trap_push (x11_display);
changes.stack_mode = changes.sibling ? Above : Below;
@ -1034,7 +1034,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
meta_error_trap_pop (tracker->screen->display);
meta_error_trap_pop (x11_display);
}
}

View File

@ -590,7 +590,7 @@ sn_error_trap_push (SnDisplay *sn_display,
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
}
static void
@ -600,7 +600,7 @@ sn_error_trap_pop (SnDisplay *sn_display,
MetaDisplay *display;
display = meta_display_for_x_display (xdisplay);
if (display != NULL)
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
static void

View File

@ -761,7 +761,7 @@ sync_client_window_mapped (MetaWindow *window)
window->mapped = should_be_mapped;
meta_error_trap_push (window->display);
meta_error_trap_push (window->display->x11_display);
if (should_be_mapped)
{
XMapWindow (window->display->x11_display->xdisplay, window->xwindow);
@ -771,7 +771,7 @@ sync_client_window_mapped (MetaWindow *window)
XUnmapWindow (window->display->x11_display->xdisplay, window->xwindow);
window->unmaps_pending ++;
}
meta_error_trap_pop (window->display);
meta_error_trap_pop (window->display->x11_display);
}
static gboolean
@ -6772,7 +6772,7 @@ warp_grab_pointer (MetaWindow *window,
*x = CLAMP (*x, 0, window->screen->rect.width-1);
*y = CLAMP (*y, 0, window->screen->rect.height-1);
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
meta_topic (META_DEBUG_WINDOW_OPS,
"Warping pointer to %d,%d with window at %d,%d\n",
@ -6794,7 +6794,7 @@ warp_grab_pointer (MetaWindow *window,
meta_backend_warp_pointer (backend, *x, *y);
}
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (display->x11_display) != Success)
{
meta_verbose ("Failed to warp pointer for window %s\n",
window->desc);
@ -8057,14 +8057,14 @@ window_has_pointer_x11 (MetaWindow *window)
XIModifierState mods;
XIGroupState group;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XIQueryPointer (display->x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
display->x11_display->xroot,
&root, &child,
&root_x, &root_y, &x, &y,
&buttons, &mods, &group);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
free (buttons.mask);
return meta_display_lookup_x_window (display, child) == window;

View File

@ -25,13 +25,13 @@
#include <X11/Xlib.h>
#include <meta/util.h>
#include <meta/display.h>
#include <meta/meta-x11-display.h>
void meta_error_trap_push (MetaDisplay *display);
void meta_error_trap_pop (MetaDisplay *display);
void meta_error_trap_push (MetaX11Display *x11_display);
void meta_error_trap_pop (MetaX11Display *x11_display);
/* returns X error code, or 0 for no error */
int meta_error_trap_pop_with_return (MetaDisplay *display);
int meta_error_trap_pop_with_return (MetaX11Display *x11_display);
#endif

View File

@ -615,9 +615,9 @@ meta_window_wayland_new (MetaDisplay *display,
* X requests (passing a window xid of None) until we thoroughly audit all
* the code to make sure it knows about non X based clients...
*/
meta_error_trap_push (display); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
meta_error_trap_push (display->x11_display); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
window = _meta_window_shared_new (display,
scr,
@ -629,7 +629,7 @@ meta_window_wayland_new (MetaDisplay *display,
&attrs);
window->can_ping = TRUE;
meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
meta_error_trap_pop (display->x11_display); /* pop the XSync()-reducing trap */
return window;
}

View File

@ -654,10 +654,10 @@ wayland_selection_data_free (WaylandSelectionData *data)
/* Do *not* change the event mask on the root window, bugger! */
if (!data->window && data->request_event.requestor != x11_display->xroot)
{
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
data->request_event.requestor, NoEventMask);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
}
g_cancellable_cancel (data->cancellable);

View File

@ -535,10 +535,10 @@ meta_spew_core_event (MetaDisplay *display,
name = "PropertyNotify";
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
str = XGetAtomName (display->x11_display->xdisplay,
event->xproperty.atom);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
if (event->xproperty.state == PropertyNewValue)
state = "PropertyNewValue";
@ -569,10 +569,10 @@ meta_spew_core_event (MetaDisplay *display,
{
char *str;
name = "ClientMessage";
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
str = XGetAtomName (display->x11_display->xdisplay,
event->xclient.message_type);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
extra = g_strdup_printf ("type: %s format: %d\n",
str ? str : "(unknown atom)",
event->xclient.format);
@ -972,12 +972,12 @@ process_request_frame_extents (MetaDisplay *display,
"to top = %lu, left = %lu, bottom = %lu, right = %lu\n",
xwindow, data[0], data[1], data[2], data[3]);
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XChangeProperty (display->x11_display->xdisplay, xwindow,
display->x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
meta_XFree (hints);
}
@ -1000,7 +1000,7 @@ convert_property (MetaDisplay *display,
conversion_targets[2] = x11_display->atom_TIMESTAMP;
conversion_targets[3] = x11_display->atom_VERSION;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
if (target == x11_display->atom_TARGETS)
XChangeProperty (x11_display->xdisplay, w, property,
XA_ATOM, 32, PropModeReplace,
@ -1015,11 +1015,11 @@ convert_property (MetaDisplay *display,
(unsigned char *)icccm_version, 2);
else
{
meta_error_trap_pop_with_return (display);
meta_error_trap_pop_with_return (x11_display);
return FALSE;
}
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
return FALSE;
/* Be sure the PropertyNotify has arrived so we
@ -1046,10 +1046,10 @@ process_selection_request (MetaDisplay *display,
{
char *str;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
str = XGetAtomName (x11_display->xdisplay,
event->xselectionrequest.selection);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
meta_verbose ("Selection request with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionrequest.owner);
@ -1076,18 +1076,18 @@ process_selection_request (MetaDisplay *display,
unsigned long num, rest;
unsigned char *data;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
if (XGetWindowProperty (x11_display->xdisplay,
event->xselectionrequest.requestor,
event->xselectionrequest.property, 0, 256, False,
x11_display->atom_ATOM_PAIR,
&type, &format, &num, &rest, &data) != Success)
{
meta_error_trap_pop_with_return (display);
meta_error_trap_pop_with_return (x11_display);
return;
}
if (meta_error_trap_pop_with_return (display) == Success)
if (meta_error_trap_pop_with_return (x11_display) == Success)
{
/* FIXME: to be 100% correct, should deal with rest > 0,
* but since we have 4 possible targets, we will hardly ever
@ -1104,13 +1104,13 @@ process_selection_request (MetaDisplay *display,
i += 2;
}
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
event->xselectionrequest.requestor,
event->xselectionrequest.property,
x11_display->atom_ATOM_PAIR,
32, PropModeReplace, data, num);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
meta_XFree (data);
}
}
@ -1145,10 +1145,10 @@ process_selection_clear (MetaDisplay *display,
{
char *str;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
str = XGetAtomName (display->x11_display->xdisplay,
event->xselectionclear.selection);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize\n",
str ? str : "(bad atom)", event->xselectionclear.window);
@ -1310,9 +1310,9 @@ handle_other_xevent (MetaDisplay *display,
{
meta_warning ("Unexpected destruction of frame 0x%lx, not sure if this should silently fail or be considered a bug\n",
window->frame->xwindow);
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
meta_window_destroy_frame (window->frame->window);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
}
else
{
@ -1449,10 +1449,10 @@ handle_other_xevent (MetaDisplay *display,
meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in mask)\n",
xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
XConfigureWindow (x11_display->xdisplay, event->xconfigurerequest.window,
xwcm, &xwc);
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
}
else
{

View File

@ -210,7 +210,7 @@ read_rgb_icon (MetaDisplay *display,
int mini_w, mini_h;
gulong *data_as_long;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
type = None;
data = NULL;
result = XGetWindowProperty (display->x11_display->xdisplay,
@ -219,7 +219,7 @@ read_rgb_icon (MetaDisplay *display,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, &data);
err = meta_error_trap_pop_with_return (display);
err = meta_error_trap_pop_with_return (display->x11_display);
if (err != Success ||
result != Success)
@ -340,7 +340,7 @@ try_pixmap_and_mask (MetaDisplay *display,
if (src_pixmap == None)
return FALSE;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
get_pixmap_geometry (display, src_pixmap, &w, &h, &d);
icon = surface_from_pixmap (xdisplay, src_pixmap, w, h);
@ -353,7 +353,7 @@ try_pixmap_and_mask (MetaDisplay *display,
mask = surface_from_pixmap (xdisplay, src_mask, w, h);
}
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
if (icon && mask)
{
@ -404,7 +404,7 @@ get_kwm_win_icon (MetaDisplay *display,
*pixmap = None;
*mask = None;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
icons = NULL;
result = XGetWindowProperty (display->x11_display->xdisplay, xwindow,
display->x11_display->atom__KWM_WIN_ICON,
@ -415,7 +415,7 @@ get_kwm_win_icon (MetaDisplay *display,
&bytes_after, &data);
icons = (Pixmap *)data;
err = meta_error_trap_pop_with_return (display);
err = meta_error_trap_pop_with_return (display->x11_display);
if (err != Success ||
result != Success)
return;

View File

@ -58,9 +58,9 @@ meta_x11_display_dispose (GObject *object)
if (x11_display->xroot != None)
{
meta_error_trap_push (x11_display->display);
meta_error_trap_push (x11_display);
XSelectInput (x11_display->xdisplay, x11_display->xroot, 0);
if (meta_error_trap_pop_with_return (x11_display->display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
meta_warning ("Could not release screen %d on display \"%s\"\n",
meta_ui_get_screen_number (), x11_display->name);

View File

@ -573,11 +573,11 @@ set_title_text (MetaWindow *window,
/* Bug 330671 -- Don't forget to clear _NET_WM_VISIBLE_(ICON_)NAME */
if (!modified && previous_was_modified)
{
meta_error_trap_push (window->display);
meta_error_trap_push (window->display->x11_display);
XDeleteProperty (window->display->x11_display->xdisplay,
window->xwindow,
atom);
meta_error_trap_pop (window->display);
meta_error_trap_pop (window->display->x11_display);
}
return modified;

View File

@ -93,10 +93,10 @@ send_icccm_message (MetaWindow *window,
ev.data.l[0] = atom;
ev.data.l[1] = timestamp;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XSendEvent (x11_display->xdisplay,
window->xwindow, False, 0, (XEvent*) &ev);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static Window
@ -250,11 +250,11 @@ send_configure_notify (MetaWindow *window)
event.xconfigure.x, event.xconfigure.y,
event.xconfigure.width, event.xconfigure.height);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XSendEvent (x11_display->xdisplay,
window->xwindow,
False, StructureNotifyMask, &event);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static void
@ -577,7 +577,7 @@ meta_window_x11_unmanage (MetaWindow *window)
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (window_x11);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
meta_window_x11_destroy_sync_request_alarm (window);
@ -657,7 +657,7 @@ meta_window_x11_unmanage (MetaWindow *window)
meta_display_ungrab_window_buttons (window->display, window->xwindow);
meta_display_ungrab_focus_window_button (window->display, window);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
if (window->frame)
{
@ -686,7 +686,7 @@ meta_window_x11_delete (MetaWindow *window,
{
MetaX11Display *x11_display = window->display->x11_display;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
if (window->delete_window)
{
meta_topic (META_DEBUG_WINDOW_OPS,
@ -701,7 +701,7 @@ meta_window_x11_delete (MetaWindow *window,
window->desc);
XKillClient (x11_display->xdisplay, window->xwindow);
}
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static void
@ -713,9 +713,9 @@ meta_window_x11_kill (MetaWindow *window)
"Disconnecting %s with XKillClient()\n",
window->desc);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XKillClient (x11_display->xdisplay, window->xwindow);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static void
@ -900,12 +900,12 @@ update_net_frame_extents (MetaWindow *window)
"to left = %lu, right = %lu, top = %lu, bottom = %lu\n",
window->xwindow, data[0], data[1], data[2], data[3]);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay, window->xwindow,
x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static void
@ -927,13 +927,13 @@ update_gtk_edge_constraints (MetaWindow *window)
meta_verbose ("Setting _GTK_EDGE_CONSTRAINTS to %lu\n", data[0]);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
window->xwindow,
x11_display->atom__GTK_EDGE_CONSTRAINTS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 1);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static gboolean
@ -1048,12 +1048,12 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu\n",
window->desc, data[0]);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay, window->xwindow,
x11_display->atom__NET_WM_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
static void
@ -1255,7 +1255,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
if (mask != 0)
{
meta_error_trap_push (window->display);
meta_error_trap_push (window->display->x11_display);
if (window == window->display->grab_window &&
meta_grab_op_is_resizing (window->display->grab_op) &&
@ -1272,7 +1272,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
mask,
&values);
meta_error_trap_pop (window->display);
meta_error_trap_pop (window->display->x11_display);
}
if (!configure_frame_first && window->frame)
@ -1676,12 +1676,12 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_verbose ("Setting _NET_WM_STATE with %d atoms\n", i);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay, window->xwindow,
x11_display->atom__NET_WM_STATE,
XA_ATOM,
32, PropModeReplace, (guchar*) data, i);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
if (window->fullscreen)
{
@ -1701,22 +1701,22 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
window->fullscreen_monitors.right);
meta_verbose ("Setting _NET_WM_FULLSCREEN_MONITORS\n");
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
window->xwindow,
x11_display->atom__NET_WM_FULLSCREEN_MONITORS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 4);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
else
{
meta_verbose ("Clearing _NET_WM_FULLSCREEN_MONITORS\n");
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XDeleteProperty (x11_display->xdisplay,
window->xwindow,
x11_display->atom__NET_WM_FULLSCREEN_MONITORS);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
}
}
@ -1804,13 +1804,13 @@ meta_window_x11_update_input_region (MetaWindow *window)
XRectangle *rects = NULL;
int n_rects = -1, ordering;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
rects = XShapeGetRectangles (x11_display->xdisplay,
window->xwindow,
ShapeInput,
&n_rects,
&ordering);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
/* XXX: The X Shape specification is quite unfortunately specified.
*
@ -1911,7 +1911,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
unsigned w_bounding, h_bounding, w_clip, h_clip;
int bounding_shaped, clip_shaped;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XShapeQueryExtents (x11_display->xdisplay, window->xwindow,
&bounding_shaped, &x_bounding, &y_bounding,
&w_bounding, &h_bounding,
@ -1926,7 +1926,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
&n_rects,
&ordering);
}
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
if (rects)
{
@ -2437,14 +2437,14 @@ meta_window_x11_client_message (MetaWindow *window,
char *str1;
char *str2;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
str1 = XGetAtomName (x11_display->xdisplay, first);
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
str1 = NULL;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
str2 = XGetAtomName (x11_display->xdisplay, second);
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
str2 = NULL;
meta_verbose ("Request to change _NET_WM_STATE action %lu atom1: %s atom2: %s\n",
@ -2859,12 +2859,12 @@ set_wm_state_on_xwindow (MetaDisplay *display,
data[0] = state;
data[1] = None;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
XChangeProperty (display->x11_display->xdisplay, xwindow,
display->x11_display->atom_WM_STATE,
display->x11_display->atom_WM_STATE,
32, PropModeReplace, (guchar*) data, 2);
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
}
void
@ -2917,7 +2917,7 @@ maybe_filter_xwindow (MetaDisplay *display,
filtered = TRUE;
meta_error_trap_push (display);
meta_error_trap_push (display->x11_display);
success = XGetClassHint (display->x11_display->xdisplay,
xwindow, &class_hint);
@ -2962,7 +2962,7 @@ maybe_filter_xwindow (MetaDisplay *display,
XUnmapWindow (display->x11_display->xdisplay, xwindow);
}
meta_error_trap_pop (display);
meta_error_trap_pop (display->x11_display);
return filtered;
}
@ -3045,9 +3045,9 @@ meta_window_x11_new (MetaDisplay *display,
return NULL;
}
meta_error_trap_push (display); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
meta_error_trap_push (x11_display); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
/*
* This function executes without any server grabs held. This means that
* the window could have already gone away, or could go away at any point,
@ -3116,7 +3116,7 @@ meta_window_x11_new (MetaDisplay *display,
*/
XAddToSaveSet (x11_display->xdisplay, xwindow);
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
event_mask = PropertyChangeMask;
if (attrs.override_redirect)
@ -3160,7 +3160,7 @@ meta_window_x11_new (MetaDisplay *display,
&set_attrs);
}
if (meta_error_trap_pop_with_return (display) != Success)
if (meta_error_trap_pop_with_return (x11_display) != Success)
{
meta_verbose ("Window 0x%lx disappeared just as we tried to manage it\n",
xwindow);
@ -3188,11 +3188,11 @@ meta_window_x11_new (MetaDisplay *display,
meta_display_grab_focus_window_button (window->display, window);
}
meta_error_trap_pop (display); /* pop the XSync()-reducing trap */
meta_error_trap_pop (x11_display); /* pop the XSync()-reducing trap */
return window;
error:
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
return NULL;
}
@ -3246,10 +3246,10 @@ meta_window_x11_recalc_window_type (MetaWindow *window)
*/
type = META_WINDOW_NORMAL;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
atom_name = XGetAtomName (x11_display->xdisplay,
priv->type_atom);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
meta_warning ("Unrecognized type atom [%s] set for %s \n",
atom_name ? atom_name : "unknown",
@ -3412,12 +3412,12 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms\n", i);
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay, window->xwindow,
x11_display->atom__NET_WM_ALLOWED_ACTIONS,
XA_ATOM,
32, PropModeReplace, (guchar*) data, i);
meta_error_trap_pop (window->display);
meta_error_trap_pop (x11_display);
#undef MAX_N_ACTIONS
}
@ -3432,7 +3432,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
window->sync_request_alarm != None)
return;
meta_error_trap_push (window->display);
meta_error_trap_push (x11_display);
/* In the new (extended style), the counter value is initialized by
* the client before mapping the window. In the old style, we're
@ -3444,7 +3444,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
window->sync_request_counter,
&init))
{
meta_error_trap_pop_with_return (window->display);
meta_error_trap_pop_with_return (x11_display);
window->sync_request_counter = None;
return;
}
@ -3483,7 +3483,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
XSyncCAEvents,
&values);
if (meta_error_trap_pop_with_return (window->display) == Success)
if (meta_error_trap_pop_with_return (x11_display) == Success)
meta_display_register_sync_alarm (window->display, &window->sync_request_alarm, window);
else
{

View File

@ -126,11 +126,11 @@ validate_or_free_results (GetPropertyResults *results,
(!must_have_items || results->n_items > 0))
return TRUE;
meta_error_trap_push (results->display);
meta_error_trap_push (x11_display);
type_name = XGetAtomName (x11_display->xdisplay, results->type);
expected_name = XGetAtomName (x11_display->xdisplay, expected_type);
prop_name = XGetAtomName (x11_display->xdisplay, results->xatom);
meta_error_trap_pop (results->display);
meta_error_trap_pop (x11_display);
w = meta_display_lookup_x_window (results->display, results->xwindow);
@ -464,9 +464,9 @@ utf8_list_from_results (GetPropertyResults *results,
{
char *name;
meta_error_trap_push (results->display);
meta_error_trap_push (results->display->x11_display);
name = XGetAtomName (results->display->x11_display->xdisplay, results->xatom);
meta_error_trap_pop (results->display);
meta_error_trap_pop (results->display->x11_display);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list\n",
name, results->xwindow, i);
meta_XFree (name);
@ -520,12 +520,12 @@ meta_prop_set_utf8_string_hint (MetaDisplay *display,
{
MetaX11Display *x11_display = display->x11_display;
meta_error_trap_push (display);
meta_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay,
xwindow, atom,
x11_display->atom_UTF8_STRING,
8, PropModeReplace, (guchar*) val, strlen (val));
meta_error_trap_pop (display);
meta_error_trap_pop (x11_display);
}
static gboolean