x11: Drop error trap helpers

They are no longer that useful as they end up calling
mtk functions nowadays

Followup of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3230

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3483>
This commit is contained in:
Bilal Elmoussaoui 2024-01-03 15:43:36 +01:00 committed by Robert Mader
parent 5564eaeb4a
commit 94f9d88371
35 changed files with 208 additions and 326 deletions

View File

@ -60,7 +60,6 @@
#include "core/util-private.h"
#include "meta/main.h"
#include "meta/meta-enum-types.h"
#include "meta/meta-x11-errors.h"
#include "meta-dbus-display-config.h"

View File

@ -57,7 +57,6 @@
#include "backends/native/meta-virtual-monitor-native.h"
#include "clutter/clutter.h"
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
#include "meta-dbus-display-config.h"

View File

@ -57,7 +57,7 @@
#include "core/display-private.h"
#include "meta/meta-cursor-tracker.h"
#include "meta/util.h"
#include "mtk/mtk-x11-errors.h"
#include "mtk/mtk-x11.h"
struct _MetaBackendX11Private
{

View File

@ -22,7 +22,6 @@
#include "backends/x11/cm/meta-cursor-sprite-xfixes.h"
#include "clutter/clutter-private.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
#define UPDATE_POSITION_TIMEOUT_MS (ms (100))

View File

@ -39,7 +39,6 @@
#include "cogl/cogl.h"
#include "core/display-private.h"
#include "meta/meta-context.h"
#include "meta/meta-x11-errors.h"
#define STAGE_X11_IS_MAPPED(s) ((((MetaStageX11 *) (s))->wm_state & STAGE_X11_WITHDRAWN) == 0)

View File

@ -87,7 +87,6 @@
#include "compositor/meta-window-actor-x11.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
#endif

View File

@ -31,7 +31,6 @@
#include "compositor/meta-module.h"
#include "core/meta-inhibit-shortcuts-dialog-default-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
#include "meta/workspace.h"

View File

@ -32,7 +32,7 @@
#include "compositor/meta-shaped-texture-private.h"
#include "compositor/meta-window-actor-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
@ -77,10 +77,10 @@ free_damage (MetaSurfaceActorX11 *self)
xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
XDamageDestroy (xdisplay, self->damage);
self->damage = None;
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
}
static void
@ -102,10 +102,10 @@ detach_pixmap (MetaSurfaceActorX11 *self)
meta_shaped_texture_set_texture (stex, NULL);
cogl_flush ();
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
XFreePixmap (xdisplay, self->pixmap);
self->pixmap = None;
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
g_clear_object (&self->texture);
}
@ -153,10 +153,10 @@ update_pixmap (MetaSurfaceActorX11 *self)
Pixmap new_pixmap;
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
new_pixmap = XCompositeNameWindowPixmap (xdisplay, xwindow);
if (meta_x11_error_trap_pop_with_return (display->x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (xdisplay) != Success)
{
/* Probably a BadMatch if the window isn't viewable; we could
* GrabServer/GetWindowAttributes/NameWindowPixmap/UngrabServer/Sync
@ -234,9 +234,9 @@ meta_surface_actor_x11_handle_updates (MetaSurfaceActorX11 *self)
if (self->received_damage)
{
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
XDamageSubtract (xdisplay, self->damage, None, None);
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
self->received_damage = FALSE;
}
@ -276,7 +276,7 @@ sync_unredirected (MetaSurfaceActorX11 *self)
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
if (self->unredirected)
{
@ -291,7 +291,7 @@ sync_unredirected (MetaSurfaceActorX11 *self)
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
}
void
@ -316,10 +316,10 @@ release_x11_resources (MetaSurfaceActorX11 *self)
{
MetaX11Display *x11_display = meta_display_get_x11_display (self->display);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
detach_pixmap (self);
free_damage (self);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -358,9 +358,9 @@ create_damage (MetaSurfaceActorX11 *self)
Display *xdisplay = meta_x11_display_get_xdisplay (x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (self->window);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (xdisplay);
self->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (xdisplay);
}
static void

View File

@ -35,7 +35,6 @@
#include "meta/meta-enum-types.h"
#include "meta/meta-shadow-factory.h"
#include "meta/meta-window-actor.h"
#include "meta/meta-x11-errors.h"
#include "meta/window.h"
#include "x11/window-x11.h"
#include "x11/meta-sync-counter.h"

View File

@ -31,7 +31,6 @@
#include "compositor/compositor-private.h"
#include "core/util-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "meta/workspace.h"
static void

View File

@ -69,7 +69,6 @@
#include "backends/x11/cm/meta-backend-x11-cm.h"
#include "backends/x11/nested/meta-backend-x11-nested.h"
#include "compositor/meta-compositor-x11.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-startup-notification-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"

View File

@ -29,7 +29,7 @@
#include "compositor/compositor-private.h"
#include "core/bell.h"
#include "core/keybindings-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/window-props.h"
@ -47,7 +47,7 @@ meta_window_ensure_frame (MetaWindow *window)
MetaX11Display *x11_display = window->display->x11_display;
unsigned long data[1] = { 1 };
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
meta_window_x11_get_xwindow (window),
@ -55,7 +55,7 @@ meta_window_ensure_frame (MetaWindow *window)
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
void
@ -103,7 +103,7 @@ meta_window_set_frame_xwindow (MetaWindow *window,
meta_verbose ("Frame for %s is 0x%lx", frame->window->desc, frame->xwindow);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
attrs.event_mask = EVENT_MASK;
XChangeWindowAttributes (x11_display->xdisplay,
@ -134,7 +134,7 @@ meta_window_set_frame_xwindow (MetaWindow *window,
frame->child_y);
window->reparents_pending += 1;
/* FIXME handle this error */
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
/* Ensure focus is restored after the unmap/map events triggered
* by XReparentWindow().
@ -152,9 +152,9 @@ meta_window_set_frame_xwindow (MetaWindow *window,
x11_display->atom__NET_WM_OPAQUE_REGION,
TRUE);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XMapWindow (x11_display->xdisplay, frame->xwindow);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
/* Move keybindings to frame instead of window */
meta_window_grab_keys (window);
@ -187,7 +187,7 @@ meta_window_destroy_frame (MetaWindow *window)
/* Unparent the client window; it may be destroyed,
* thus the error trap.
*/
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
if (window->mapped)
{
window->mapped = FALSE; /* Keep track of unmapping it, so we
@ -227,7 +227,7 @@ meta_window_destroy_frame (MetaWindow *window)
meta_window_x11_get_xwindow (window),
x11_display->atom__MUTTER_NEEDS_FRAME);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
/* Ensure focus is restored after the unmap/map events triggered
* by XReparentWindow().
@ -279,7 +279,7 @@ meta_frame_query_borders (MetaFrame *frame,
if (!frame->xwindow)
return;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
res = XGetWindowProperty (x11_display->xdisplay,
frame->xwindow,
@ -290,7 +290,7 @@ meta_frame_query_borders (MetaFrame *frame,
&nitems, &bytes_after,
(unsigned char **) &data);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
return;
if (res == Success && nitems == 4)
@ -305,7 +305,7 @@ meta_frame_query_borders (MetaFrame *frame,
g_clear_pointer (&data, XFree);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
res = XGetWindowProperty (x11_display->xdisplay,
frame->xwindow,
@ -316,7 +316,7 @@ meta_frame_query_borders (MetaFrame *frame,
&nitems, &bytes_after,
(unsigned char **) &data);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
return;
if (res == Success && nitems == 4)
@ -379,7 +379,7 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->rect.x + frame->rect.width,
frame->rect.y + frame->rect.height);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XMoveResizeWindow (x11_display->xdisplay,
frame->xwindow,
@ -388,7 +388,7 @@ meta_frame_sync_to_window (MetaFrame *frame,
frame->rect.width,
frame->rect.height);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
return need_resize;
}
@ -457,11 +457,11 @@ send_configure_notify (MetaFrame *frame)
event.xconfigure.above = None;
event.xconfigure.override_redirect = False;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (x11_display->xdisplay,
frame->xwindow,
False, StructureNotifyMask, &event);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
gboolean

View File

@ -42,8 +42,8 @@
#include "compositor/compositor-private.h"
#include "core/display-private.h"
#include "core/frame.h"
#include "meta/meta-x11-errors.h"
#include "meta/util.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
@ -1179,7 +1179,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
{
serial = XNextRequest (x11_display->xdisplay);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
changes.stack_mode = changes.sibling ? Below : Above;
@ -1188,7 +1188,7 @@ meta_stack_tracker_lower_below (MetaStackTracker *tracker,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
}
@ -1214,7 +1214,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
{
serial = XNextRequest (x11_display->xdisplay);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
changes.stack_mode = changes.sibling ? Above : Below;
@ -1223,7 +1223,7 @@ meta_stack_tracker_raise_above (MetaStackTracker *tracker,
(changes.sibling ? CWSibling : 0) | CWStackMode,
&changes);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
}

View File

@ -29,7 +29,6 @@
#include "core/display-private.h"
#include "core/startup-notification-private.h"
#include "core/util-private.h"
#include "meta/meta-x11-errors.h"
#include "x11/meta-x11-display-private.h"
/* This should be fairly long, as it should never be required unless

View File

@ -83,8 +83,8 @@
#include "meta/group.h"
#include "meta/meta-cursor-tracker.h"
#include "meta/meta-enum-types.h"
#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-props.h"
#include "x11/window-x11.h"

View File

@ -45,7 +45,6 @@
#include "core/boxes-private.h"
#include "core/meta-workspace-manager-private.h"
#include "core/workspace-private.h"
#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
#include "x11/meta-x11-display-private.h"

View File

@ -483,7 +483,6 @@ if have_x11_client
'x11/meta-sync-counter.h',
'x11/meta-x11-display.c',
'x11/meta-x11-display-private.h',
'x11/meta-x11-errors.c',
'x11/meta-x11-event-source.c',
'x11/meta-x11-selection.c',
'x11/meta-x11-selection-private.h',

View File

@ -59,7 +59,6 @@ endif
if have_x11
mutter_public_headers += [
'meta-x11-display.h',
'meta-x11-errors.h',
]
endif

View File

@ -1,37 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Mutter X error handling */
/*
* Copyright (C) 2001 Havoc Pennington
*
* 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
#include <X11/Xlib.h>
#include "meta/util.h"
#include "meta/meta-x11-display.h"
META_EXPORT
void meta_x11_error_trap_push (MetaX11Display *x11_display);
META_EXPORT
void meta_x11_error_trap_pop (MetaX11Display *x11_display);
/* returns X error code, or 0 for no error */
META_EXPORT
int meta_x11_error_trap_pop_with_return (MetaX11Display *x11_display);

View File

@ -36,7 +36,6 @@
#include "core/boxes-private.h"
#include "core/stack-tracker.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "wayland/meta-wayland-actor-surface.h"
#include "wayland/meta-wayland-private.h"
#include "wayland/meta-wayland-surface-private.h"

View File

@ -21,7 +21,7 @@
#include <X11/Xatom.h>
#include "core/frame.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/window-x11-private.h"
@ -208,12 +208,12 @@ apply_allow_commits_x11_property (MetaWindowXwayland *xwayland_window,
property[0] = !!allow_commits;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay, xwin,
x11_display->atom__XWAYLAND_ALLOW_COMMITS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) &property, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
XFlush (x11_display->xdisplay);
}

View File

@ -35,7 +35,7 @@
#include "core/meta-workspace-manager-private.h"
#include "core/workspace-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "wayland/meta-wayland-data-device.h"
#include "wayland/meta-xwayland-private.h"
#include "wayland/meta-xwayland-dnd-private.h"
@ -252,7 +252,7 @@ xdnd_send_enter (MetaXWaylandDnd *dnd,
gchar **p;
struct wl_array *source_mime_types;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
data_source = compositor->seat->data_device.dnd_data_source;
xev.xclient.type = ClientMessage;
@ -299,7 +299,7 @@ xdnd_send_enter (MetaXWaylandDnd *dnd,
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
g_critical ("Error sending XdndEnter");
}
@ -317,9 +317,9 @@ xdnd_send_leave (MetaXWaylandDnd *dnd,
xev.xclient.window = dest;
xev.xclient.data.l[0] = x11_display->selection.xwindow;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -355,10 +355,10 @@ xdnd_send_position (MetaXWaylandDnd *dnd,
xev.xclient.data.l[3] = time;
xev.xclient.data.l[4] = action_to_atom (action);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
g_critical ("Error sending XdndPosition");
}
@ -379,10 +379,10 @@ xdnd_send_drop (MetaXWaylandDnd *dnd,
xev.xclient.data.l[0] = x11_display->selection.xwindow;
xev.xclient.data.l[2] = time;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
g_critical ("Error sending XdndDrop");
}
@ -411,10 +411,10 @@ xdnd_send_finished (MetaXWaylandDnd *dnd,
xev.xclient.data.l[2] = action_to_atom (action);
}
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
g_critical ("Error sending XdndFinished");
}
@ -439,10 +439,10 @@ xdnd_send_status (MetaXWaylandDnd *dnd,
if (xev.xclient.data.l[4])
xev.xclient.data.l[1] |= 1 << 0; /* Bit 1: dest accepts the drop */
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (xdisplay, dest, False, NoEventMask, &xev);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
g_critical ("Error sending Xdndstatus");
}
@ -711,7 +711,7 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source,
if (source_mime_types->size != 0)
return TRUE;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
utf8_string = XInternAtom (xdisplay, "UTF8_STRING", False);
if (XGetWindowProperty (xdisplay, window, prop,
@ -725,11 +725,11 @@ meta_xwayland_data_source_fetch_mimetype_list (MetaWaylandDataSource *source,
&bytes_after_ret,
(guchar **) &atoms) != Success)
{
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (xdisplay);
return FALSE;
}
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
return FALSE;
if (nitems_ret == 0 || type_ret != XA_ATOM)

View File

@ -49,7 +49,7 @@
#include "backends/meta-settings-private.h"
#include "meta/main.h"
#include "meta/meta-backend.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "wayland/meta-xwayland-grab-keyboard.h"
#include "wayland/meta-xwayland-surface.h"
#include "x11/meta-x11-display-private.h"
@ -1227,7 +1227,7 @@ meta_xwayland_set_primary_output (MetaX11Display *x11_display)
if (!resources)
return;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
for (i = 0; i < resources->noutput; i++)
{
RROutput output_id = resources->outputs[i];
@ -1261,7 +1261,7 @@ meta_xwayland_set_primary_output (MetaX11Display *x11_display)
break;
}
}
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
XRRFreeScreenResources (resources);
}

View File

@ -41,7 +41,7 @@
#include "core/workspace-private.h"
#include "meta/meta-backend.h"
#include "meta/meta-context.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-startup-notification-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/meta-x11-event-source.h"
@ -653,10 +653,10 @@ meta_spew_core_event (MetaX11Display *x11_display,
char *str;
const char *state;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str = XGetAtomName (x11_display->xdisplay,
event->xproperty.atom);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
if (event->xproperty.state == PropertyNewValue)
state = "PropertyNewValue";
@ -674,10 +674,10 @@ meta_spew_core_event (MetaX11Display *x11_display,
case ClientMessage:
{
char *str;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str = XGetAtomName (x11_display->xdisplay,
event->xclient.message_type);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
extra = g_strdup_printf ("type: %s format: %d\n",
str ? str : "(unknown atom)",
event->xclient.format);
@ -1035,12 +1035,12 @@ process_request_frame_extents (MetaX11Display *x11_display,
"Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx",
xwindow);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay, xwindow,
x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */
@ -1059,7 +1059,7 @@ convert_property (MetaX11Display *x11_display,
conversion_targets[2] = x11_display->atom_TIMESTAMP;
conversion_targets[3] = x11_display->atom_VERSION;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
if (target == x11_display->atom_TARGETS)
XChangeProperty (x11_display->xdisplay, w, property,
XA_ATOM, 32, PropModeReplace,
@ -1074,11 +1074,11 @@ convert_property (MetaX11Display *x11_display,
(unsigned char *)icccm_version, 2);
else
{
meta_x11_error_trap_pop_with_return (x11_display);
mtk_x11_error_trap_pop_with_return (x11_display->xdisplay);
return FALSE;
}
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
return FALSE;
/* Be sure the PropertyNotify has arrived so we
@ -1103,10 +1103,10 @@ process_selection_request (MetaX11Display *x11_display,
{
char *str;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str = XGetAtomName (x11_display->xdisplay,
event->xselectionrequest.selection);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
meta_verbose ("Selection request with selection %s window 0x%lx not a WM_Sn selection we recognize",
str ? str : "(bad atom)", event->xselectionrequest.owner);
@ -1133,18 +1133,18 @@ process_selection_request (MetaX11Display *x11_display,
unsigned long num, rest;
unsigned char *data;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
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_x11_error_trap_pop_with_return (x11_display);
mtk_x11_error_trap_pop_with_return (x11_display->xdisplay);
return;
}
if (meta_x11_error_trap_pop_with_return (x11_display) == Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) == Success)
{
/* FIXME: to be 100% correct, should deal with rest > 0,
* but since we have 4 possible targets, we will hardly ever
@ -1161,13 +1161,13 @@ process_selection_request (MetaX11Display *x11_display,
i += 2;
}
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
event->xselectionrequest.requestor,
event->xselectionrequest.property,
x11_display->atom_ATOM_PAIR,
32, PropModeReplace, data, num);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
meta_XFree (data);
}
}
@ -1215,10 +1215,10 @@ process_selection_clear (MetaX11Display *x11_display,
{
char *str;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str = XGetAtomName (x11_display->xdisplay,
event->xselectionclear.selection);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
meta_verbose ("Selection clear with selection %s window 0x%lx not a WM_Sn selection we recognize",
str ? str : "(bad atom)", event->xselectionclear.window);
@ -1386,9 +1386,9 @@ handle_other_xevent (MetaX11Display *x11_display,
if (frame_was_receiver)
{
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
meta_window_destroy_frame (window->frame->window);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
else
{
@ -1456,7 +1456,7 @@ handle_other_xevent (MetaX11Display *x11_display,
unsigned long nitems, bytes_after, *data;
/* Check whether the new window is a frame for another window */
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
if (XGetWindowProperty (x11_display->xdisplay,
event->xmaprequest.window,
@ -1465,11 +1465,11 @@ handle_other_xevent (MetaX11Display *x11_display,
&type, &format, &nitems, &bytes_after,
(guchar **) &data) != Success)
{
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
break;
}
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
break;
if (nitems == 1)
@ -1560,10 +1560,10 @@ handle_other_xevent (MetaX11Display *x11_display,
meta_verbose ("Configuring withdrawn window to %d,%d %dx%d border %d (some values may not be in mask)",
xwc.x, xwc.y, xwc.width, xwc.height, xwc.border_width);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XConfigureWindow (x11_display->xdisplay, event->xconfigurerequest.window,
xwcm, &xwc);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
else if (!frame_was_receiver)
{

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-selection-input-stream-private.h"
#include "x11/meta-selection-source-x11-private.h"
@ -155,9 +155,9 @@ atoms_to_mimetypes (MetaX11Display *display,
{
char *mimetype;
meta_x11_error_trap_push (display);
mtk_x11_error_trap_push (xdisplay);
mimetype = XGetAtomName (xdisplay, atoms[i]);
meta_x11_error_trap_pop (display);
mtk_x11_error_trap_pop (xdisplay);
if (!mimetype)
continue;

View File

@ -23,7 +23,7 @@
#include "core/display-private.h"
#include "core/startup-notification-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#ifdef HAVE_STARTUP_NOTIFICATION
@ -199,7 +199,7 @@ sn_error_trap_push (SnDisplay *sn_display,
display = find_display (xdisplay);
if (display != NULL)
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (display->x11_display->xdisplay);
}
static void
@ -210,7 +210,7 @@ sn_error_trap_pop (SnDisplay *sn_display,
display = find_display (xdisplay);
if (display != NULL)
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (display->x11_display->xdisplay);
}
static void

View File

@ -21,7 +21,7 @@
#include "compositor/compositor-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-sync-counter.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11-private.h"
@ -97,7 +97,7 @@ meta_sync_counter_create_sync_alarm (MetaSyncCounter *sync_counter)
sync_counter->sync_request_alarm != None)
return;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
/* In the new (extended style), the counter value is initialized by
* the client before mapping the window. In the old style, we're
@ -109,7 +109,7 @@ meta_sync_counter_create_sync_alarm (MetaSyncCounter *sync_counter)
sync_counter->sync_request_counter,
&init))
{
meta_x11_error_trap_pop_with_return (x11_display);
mtk_x11_error_trap_pop_with_return (x11_display->xdisplay);
sync_counter->sync_request_counter = None;
return;
}
@ -148,7 +148,7 @@ meta_sync_counter_create_sync_alarm (MetaSyncCounter *sync_counter)
XSyncCAEvents,
&values);
if (meta_x11_error_trap_pop_with_return (x11_display) == Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) == Success)
{
meta_x11_display_register_sync_alarm (x11_display,
&sync_counter->sync_request_alarm,
@ -378,10 +378,10 @@ do_send_frame_drawn (MetaSyncCounter *sync_counter,
ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT (0xffffffff);
ev.data.l[3] = frame->frame_drawn_time >> 32;
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
XFlush (xdisplay);
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
#ifdef HAVE_PROFILER
if (G_UNLIKELY (cogl_is_tracing_enabled ()))
@ -438,10 +438,10 @@ do_send_frame_timings (MetaSyncCounter *sync_counter,
ev.data.l[3] = refresh_interval;
ev.data.l[4] = 1000 * META_SYNC_DELAY;
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (xdisplay);
XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
XFlush (xdisplay);
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (xdisplay);
#ifdef HAVE_PROFILER
if (G_UNLIKELY (cogl_is_tracing_enabled ()))

View File

@ -250,7 +250,3 @@ gboolean meta_x11_display_xwindow_is_a_no_focus_window (MetaX11Display *x11_disp
Window xwindow);
void meta_x11_display_clear_stage_input_region (MetaX11Display *x11_display);
void meta_x11_display_init_error_traps (MetaX11Display *x11_display);
void meta_x11_display_destroy_error_traps (MetaX11Display *x11_display);

View File

@ -58,8 +58,7 @@
#include "core/util-private.h"
#include "core/workspace-private.h"
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/events.h"
#include "x11/group-props.h"
#include "x11/meta-x11-selection-private.h"
@ -264,9 +263,9 @@ meta_x11_display_dispose (GObject *object)
{
unset_wm_check_hint (x11_display);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSelectInput (x11_display->xdisplay, x11_display->xroot, 0);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
meta_warning ("Could not release screen %d on display \"%s\"",
DefaultScreen (x11_display->xdisplay),
x11_display->name);
@ -298,9 +297,7 @@ meta_x11_display_dispose (GObject *object)
static void
meta_x11_display_finalize (GObject *object)
{
MetaX11Display *x11_display = META_X11_DISPLAY (object);
meta_x11_display_destroy_error_traps (x11_display);
mtk_x11_errors_deinit ();
G_OBJECT_CLASS (meta_x11_display_parent_class)->finalize (object);
}
@ -581,13 +578,13 @@ set_desktop_geometry_hint (MetaX11Display *x11_display)
meta_verbose ("Setting _NET_DESKTOP_GEOMETRY to %lu, %lu", data[0], data[1]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_DESKTOP_GEOMETRY,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -606,13 +603,13 @@ set_desktop_viewport_hint (MetaX11Display *x11_display)
meta_verbose ("Setting _NET_DESKTOP_VIEWPORT to 0, 0");
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_DESKTOP_VIEWPORT,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 2);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static int
@ -715,10 +712,10 @@ take_manager_selection (MetaX11Display *x11_display,
if (should_replace)
{
/* We want to find out when the current selection owner dies */
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
attrs.event_mask = StructureNotifyMask;
XChangeWindowAttributes (x11_display->xdisplay, current_owner, CWEventMask, &attrs);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
current_owner = None; /* don't wait for it to die later on */
}
else
@ -870,13 +867,13 @@ set_active_workspace_hint (MetaWorkspaceManager *workspace_manager,
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu", data[0]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -894,13 +891,13 @@ set_number_of_spaces_hint (MetaWorkspaceManager *workspace_manager,
meta_verbose ("Setting _NET_NUMBER_OF_DESKTOPS to %lu", data[0]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_NUMBER_OF_DESKTOPS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -911,13 +908,13 @@ set_showing_desktop_hint (MetaWorkspaceManager *workspace_manager,
data[0] = workspace_manager->active_workspace->showing_desktop ? 1 : 0;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_SHOWING_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -949,14 +946,14 @@ set_workspace_names (MetaX11Display *x11_display)
++i;
}
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
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_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
g_string_free (flattened, TRUE);
}
@ -1001,13 +998,13 @@ set_workspace_work_area_hint (MetaWorkspace *workspace,
workarea_atom = XInternAtom (x11_display->xdisplay, workarea_name, False);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
workarea_atom,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, num_monitors * 4);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
g_free (data);
}
@ -1041,13 +1038,13 @@ set_work_area_hint (MetaDisplay *display,
tmp += 4;
}
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_WORKAREA,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, num_workspaces*4);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
g_free (data);
}
@ -1314,7 +1311,7 @@ meta_x11_display_new (MetaDisplay *display,
#include "x11/atomnames.h"
#undef item
meta_x11_display_init_error_traps (x11_display);
mtk_x11_errors_init ();
query_xsync_extension (x11_display);
query_xshape_extension (x11_display);
@ -2022,13 +2019,13 @@ meta_x11_display_update_active_window_hint (MetaX11Display *x11_display)
else
data[0] = None;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
x11_display->xroot,
x11_display->atom__NET_ACTIVE_WINDOW,
XA_WINDOW,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
void
@ -2055,7 +2052,7 @@ meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
Window xwindow,
uint32_t timestamp)
{
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
/* 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
@ -2080,7 +2077,7 @@ meta_x11_display_set_input_focus_internal (MetaX11Display *x11_display,
XUngrabServer (x11_display->xdisplay);
XFlush (x11_display->xdisplay);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -2127,11 +2124,11 @@ meta_x11_display_set_input_focus (MetaX11Display *x11_display,
meta_topic (META_DEBUG_FOCUS, "Setting X11 input focus for window %s to 0x%lx",
window ? window->desc : "none", xwindow);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
meta_x11_display_set_input_focus_internal (x11_display, xwindow, timestamp);
serial = XNextRequest (x11_display->xdisplay);
meta_x11_display_update_focus_window (x11_display, xwindow, serial, TRUE);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static MetaX11DisplayLogicalMonitorData *
@ -2528,11 +2525,11 @@ meta_x11_display_redirect_windows (MetaX11Display *x11_display,
*/
while (TRUE)
{
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XCompositeRedirectSubwindows (xdisplay, xroot, CompositeRedirectManual);
XSync (xdisplay, FALSE);
if (!meta_x11_error_trap_pop_with_return (x11_display))
if (!mtk_x11_error_trap_pop_with_return (x11_display->xdisplay))
break;
if (n_retries == max_retries)

View File

@ -1,60 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001 Havoc Pennington, error trapping inspired by GDK
* code copyrighted by the GTK team.
*
* 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/>.
*/
/**
* Errors:
*
* Mutter X error handling
*/
#include "config.h"
#include "meta-x11-display-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
void
meta_x11_display_init_error_traps (MetaX11Display *x11_display)
{
mtk_x11_errors_init ();
}
void
meta_x11_display_destroy_error_traps (MetaX11Display *x11_display)
{
mtk_x11_errors_deinit ();
}
void
meta_x11_error_trap_push (MetaX11Display *x11_display)
{
mtk_x11_error_trap_push (x11_display->xdisplay);
}
void
meta_x11_error_trap_pop (MetaX11Display *x11_display)
{
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
int
meta_x11_error_trap_pop_with_return (MetaX11Display *x11_display)
{
return mtk_x11_error_trap_pop_with_return (x11_display->xdisplay);
}

View File

@ -23,7 +23,7 @@
#include "meta-x11-selection-input-stream-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
typedef struct MetaX11SelectionInputStreamPrivate MetaX11SelectionInputStreamPrivate;
@ -128,9 +128,9 @@ meta_x11_selection_input_stream_flush (MetaX11SelectionInputStream *stream)
Display *xdisplay = priv->x11_display->xdisplay;
gssize written;
meta_x11_error_trap_push (priv->x11_display);
mtk_x11_error_trap_push (xdisplay);
XDeleteProperty (xdisplay, priv->window, priv->xproperty);
meta_x11_error_trap_pop (priv->x11_display);
mtk_x11_error_trap_pop (xdisplay);
if (!meta_x11_selection_input_stream_has_data (stream))
return;
@ -348,18 +348,18 @@ get_selection_property (MetaX11Display *x11_display,
gint prop_format;
uint8_t *data = NULL;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
if (XGetWindowProperty (x11_display->xdisplay, owner, property,
0, 0x1FFFFFFF, False,
AnyPropertyType, &prop_type, &prop_format,
&nitems, &nbytes, &data) != Success)
{
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
goto err;
}
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
goto err;
if (prop_type != None)

View File

@ -23,7 +23,7 @@
#include "meta-x11-selection-output-stream-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
typedef struct _MetaX11SelectionOutputStreamPrivate MetaX11SelectionOutputStreamPrivate;
@ -79,16 +79,16 @@ meta_x11_selection_output_stream_notify_selection (MetaX11SelectionOutputStream
.property = priv->xproperty,
};
meta_x11_error_trap_push (priv->x11_display);
xdisplay = priv->x11_display->xdisplay;
mtk_x11_error_trap_push (xdisplay);
XSendEvent (xdisplay,
priv->xwindow, False, NoEventMask,
(XEvent *) &event);
XSync (xdisplay, False);
meta_x11_error_trap_pop (priv->x11_display);
mtk_x11_error_trap_pop (xdisplay);
}
static gboolean
@ -212,7 +212,7 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st
xdisplay = priv->x11_display->xdisplay;
/* We operate on a foreign window, better guard against catastrophe */
meta_x11_error_trap_push (priv->x11_display);
mtk_x11_error_trap_push (xdisplay);
g_mutex_lock (&priv->mutex);
@ -272,7 +272,7 @@ meta_x11_selection_output_stream_perform_flush (MetaX11SelectionOutputStream *st
g_cond_broadcast (&priv->cond);
g_mutex_unlock (&priv->mutex);
error_code = meta_x11_error_trap_pop_with_return (priv->x11_display);
error_code = mtk_x11_error_trap_pop_with_return (xdisplay);
if (error_code != Success)
{

View File

@ -48,7 +48,7 @@
#include "core/meta-workspace-manager-private.h"
#include "core/util-private.h"
#include "meta/group.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11-private.h"
#include "x11/window-x11.h"
@ -536,11 +536,11 @@ set_title_text (MetaWindow *window,
/* Bug 330671 -- Don't forget to clear _NET_WM_VISIBLE_(ICON_)NAME */
if (!modified && previous_was_modified)
{
meta_x11_error_trap_push (window->display->x11_display);
mtk_x11_error_trap_push (window->display->x11_display->xdisplay);
XDeleteProperty (window->display->x11_display->xdisplay,
meta_window_x11_get_xwindow (window),
atom);
meta_x11_error_trap_pop (window->display->x11_display);
mtk_x11_error_trap_pop (window->display->x11_display->xdisplay);
}
return modified;

View File

@ -45,8 +45,8 @@
#include "meta/common.h"
#include "meta/meta-cursor-tracker.h"
#include "meta/meta-later.h"
#include "meta/meta-x11-errors.h"
#include "meta/prefs.h"
#include "mtk/mtk-x11.h"
#ifdef HAVE_XWAYLAND
#include "wayland/meta-window-xwayland.h"
@ -137,10 +137,10 @@ send_icccm_message (MetaWindow *window,
ev.data.l[0] = atom;
ev.data.l[1] = timestamp;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (x11_display->xdisplay,
meta_window_x11_get_xwindow (window), False, 0, (XEvent*) &ev);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static Window
@ -285,11 +285,11 @@ send_configure_notify (MetaWindow *window)
event.xconfigure.x, event.xconfigure.y,
event.xconfigure.width, event.xconfigure.height);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XSendEvent (x11_display->xdisplay,
priv->xwindow,
False, StructureNotifyMask, &event);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -633,7 +633,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_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
meta_window_x11_destroy_sync_request_alarm (window);
@ -713,7 +713,7 @@ meta_window_x11_unmanage (MetaWindow *window)
meta_display_ungrab_window_buttons (window->display, window);
meta_display_ungrab_focus_window_button (window->display, window);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
if (window->frame)
{
@ -779,7 +779,7 @@ meta_window_x11_delete (MetaWindow *window,
meta_window_x11_get_instance_private (window_x11);
MetaX11Display *x11_display = window->display->x11_display;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
if (priv->wm_delete_window)
{
meta_topic (META_DEBUG_WINDOW_OPS,
@ -794,7 +794,7 @@ meta_window_x11_delete (MetaWindow *window,
window->desc);
XKillClient (x11_display->xdisplay, priv->xwindow);
}
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -806,10 +806,10 @@ meta_window_x11_kill (MetaWindow *window)
"Disconnecting %s with XKillClient()",
window->desc);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XKillClient (x11_display->xdisplay,
meta_window_x11_get_xwindow (window));
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -1153,12 +1153,12 @@ update_net_frame_extents (MetaWindow *window)
"to left = %lu, right = %lu, top = %lu, bottom = %lu",
xwindow, data[0], data[1], data[2], data[3]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay, xwindow,
x11_display->atom__NET_FRAME_EXTENTS,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static gboolean
@ -1231,13 +1231,13 @@ update_gtk_edge_constraints (MetaWindow *window)
meta_verbose ("Setting _GTK_EDGE_CONSTRAINTS to %lu", data[0]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
window->frame ? window->frame->xwindow : meta_window_x11_get_xwindow (window),
x11_display->atom__GTK_EDGE_CONSTRAINTS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static unsigned long
@ -1266,13 +1266,13 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
meta_verbose ("Setting _NET_WM_DESKTOP of %s to %lu",
window->desc, data[0]);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
meta_window_x11_get_xwindow (window),
x11_display->atom__NET_WM_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static gboolean
@ -1491,7 +1491,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
if (need_resize_client)
mask |= (CWWidth | CWHeight);
meta_x11_error_trap_push (window->display->x11_display);
mtk_x11_error_trap_push (window->display->x11_display->xdisplay);
window_drag =
meta_compositor_get_current_window_drag (window->display->compositor);
@ -1520,7 +1520,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
if (!configure_frame_first && window->frame)
frame_shape_changed = meta_frame_sync_to_window (window->frame, need_resize_frame);
meta_x11_error_trap_pop (window->display->x11_display);
mtk_x11_error_trap_pop (window->display->x11_display->xdisplay);
if (window->frame)
window->buffer_rect = window->frame->rect;
@ -1964,10 +1964,10 @@ meta_window_x11_map (MetaWindow *window)
{
MetaX11Display *x11_display = window->display->x11_display;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XMapWindow (x11_display->xdisplay,
meta_window_x11_get_xwindow (window));
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static void
@ -1975,10 +1975,10 @@ meta_window_x11_unmap (MetaWindow *window)
{
MetaX11Display *x11_display = window->display->x11_display;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XUnmapWindow (x11_display->xdisplay,
meta_window_x11_get_xwindow (window));
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
window->unmaps_pending ++;
}
@ -2263,7 +2263,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
meta_verbose ("Setting _NET_WM_STATE with %d atoms", i);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay, priv->xwindow,
x11_display->atom__NET_WM_STATE,
XA_ATOM,
@ -2278,7 +2278,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
32, PropModeReplace, (guchar*) data, i);
}
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
if (window->fullscreen)
{
@ -2298,22 +2298,22 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
window->fullscreen_monitors.right);
meta_verbose ("Setting _NET_WM_FULLSCREEN_MONITORS");
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
priv->xwindow,
x11_display->atom__NET_WM_FULLSCREEN_MONITORS,
XA_CARDINAL, 32, PropModeReplace,
(guchar*) data, 4);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
else
{
meta_verbose ("Clearing _NET_WM_FULLSCREEN_MONITORS");
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XDeleteProperty (x11_display->xdisplay,
priv->xwindow,
x11_display->atom__NET_WM_FULLSCREEN_MONITORS);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
}
@ -2406,13 +2406,13 @@ meta_window_x11_update_input_region (MetaWindow *window)
XRectangle *rects = NULL;
int n_rects = -1, ordering;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
rects = XShapeGetRectangles (x11_display->xdisplay,
xwindow,
ShapeInput,
&n_rects,
&ordering);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
/* XXX: The X Shape specification is quite unfortunately specified.
*
@ -2512,7 +2512,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
unsigned w_bounding, h_bounding, w_clip, h_clip;
int bounding_shaped, clip_shaped;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XShapeQueryExtents (x11_display->xdisplay, priv->xwindow,
&bounding_shaped, &x_bounding, &y_bounding,
&w_bounding, &h_bounding,
@ -2527,7 +2527,7 @@ meta_window_x11_update_shape_region (MetaWindow *window)
&n_rects,
&ordering);
}
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
if (rects)
{
@ -3148,14 +3148,14 @@ meta_window_x11_client_message (MetaWindow *window,
char *str1;
char *str2;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str1 = XGetAtomName (x11_display->xdisplay, first);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
str1 = NULL;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
str2 = XGetAtomName (x11_display->xdisplay, second);
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
str2 = NULL;
meta_verbose ("Request to change _NET_WM_STATE action %lu atom1: %s atom2: %s",
@ -3575,12 +3575,12 @@ set_wm_state_on_xwindow (MetaDisplay *display,
data[0] = state;
data[1] = None;
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (display->x11_display->xdisplay);
XChangeProperty (display->x11_display->xdisplay, xwindow,
display->x11_display->atom_WM_STATE,
display->x11_display->atom_WM_STATE,
32, PropModeReplace, (guchar*) data, 2);
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (display->x11_display->xdisplay);
}
void
@ -3635,7 +3635,7 @@ maybe_filter_xwindow (MetaDisplay *display,
filtered = TRUE;
meta_x11_error_trap_push (display->x11_display);
mtk_x11_error_trap_push (display->x11_display->xdisplay);
success = XGetClassHint (display->x11_display->xdisplay,
xwindow, &class_hint);
@ -3680,7 +3680,7 @@ maybe_filter_xwindow (MetaDisplay *display,
XUnmapWindow (display->x11_display->xdisplay, xwindow);
}
meta_x11_error_trap_pop (display->x11_display);
mtk_x11_error_trap_pop (display->x11_display->xdisplay);
return filtered;
}
@ -3767,7 +3767,7 @@ meta_window_x11_new (MetaDisplay *display,
return NULL;
}
meta_x11_error_trap_push (x11_display); /* Push a trap over all of window
mtk_x11_error_trap_push (x11_display->xdisplay); /* Push a trap over all of window
* creation, to reduce XSync() calls
*/
/*
@ -3839,7 +3839,7 @@ meta_window_x11_new (MetaDisplay *display,
*/
XAddToSaveSet (x11_display->xdisplay, xwindow);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
event_mask = PropertyChangeMask;
if (attrs.override_redirect)
@ -3883,7 +3883,7 @@ meta_window_x11_new (MetaDisplay *display,
&set_attrs);
}
if (meta_x11_error_trap_pop_with_return (x11_display) != Success)
if (mtk_x11_error_trap_pop_with_return (x11_display->xdisplay) != Success)
{
meta_verbose ("Window 0x%lx disappeared just as we tried to manage it",
xwindow);
@ -3932,11 +3932,11 @@ meta_window_x11_new (MetaDisplay *display,
meta_display_grab_focus_window_button (window->display, window);
}
meta_x11_error_trap_pop (x11_display); /* pop the XSync()-reducing trap */
mtk_x11_error_trap_pop (x11_display->xdisplay); /* pop the XSync()-reducing trap */
return window;
error:
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
return NULL;
}
@ -3990,10 +3990,10 @@ meta_window_x11_recalc_window_type (MetaWindow *window)
*/
type = META_WINDOW_NORMAL;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
atom_name = XGetAtomName (x11_display->xdisplay,
priv->type_atom);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
meta_warning ("Unrecognized type atom [%s] set for %s ",
atom_name ? atom_name : "unknown",
@ -4151,7 +4151,7 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
meta_verbose ("Setting _NET_WM_ALLOWED_ACTIONS with %d atoms", i);
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
meta_window_x11_get_xwindow (window),
x11_display->atom__NET_WM_ALLOWED_ACTIONS,
@ -4167,7 +4167,7 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
32, PropModeReplace, (guchar*) data, i);
}
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
#undef MAX_N_ACTIONS
}
@ -4474,14 +4474,14 @@ meta_window_x11_has_pointer (MetaWindow *window)
XIModifierState mods;
XIGroupState group;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XIQueryPointer (x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
x11_display->xroot,
&root, &child,
&root_x, &root_y, &x, &y,
&buttons, &mods, &group);
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
free (buttons.mask);
return meta_x11_display_lookup_x_window (x11_display, child) == window;

View File

@ -89,7 +89,7 @@ from The Open Group.
#include "core/util-private.h"
#include "core/window-private.h"
#include "meta/meta-x11-errors.h"
#include "mtk/mtk-x11.h"
#include "x11/meta-x11-display-private.h"
#include "x11/mutter-Xatomtype.h"
@ -125,11 +125,11 @@ validate_or_free_results (GetPropertyResults *results,
(!must_have_items || results->n_items > 0))
return TRUE;
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
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_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
w = meta_x11_display_lookup_x_window (x11_display, results->xwindow);
@ -432,9 +432,9 @@ utf8_list_from_results (GetPropertyResults *results,
{
char *name;
meta_x11_error_trap_push (results->x11_display);
mtk_x11_error_trap_push (results->x11_display->xdisplay);
name = XGetAtomName (results->x11_display->xdisplay, results->xatom);
meta_x11_error_trap_pop (results->x11_display);
mtk_x11_error_trap_pop (results->x11_display->xdisplay);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8 for item %d in the list",
name, results->xwindow, i);
meta_XFree (name);
@ -486,12 +486,12 @@ meta_prop_set_utf8_string_hint (MetaX11Display *x11_display,
Atom atom,
const char *val)
{
meta_x11_error_trap_push (x11_display);
mtk_x11_error_trap_push (x11_display->xdisplay);
XChangeProperty (x11_display->xdisplay,
xwindow, atom,
x11_display->atom_UTF8_STRING,
8, PropModeReplace, (guchar*) val, strlen (val));
meta_x11_error_trap_pop (x11_display);
mtk_x11_error_trap_pop (x11_display->xdisplay);
}
static gboolean
@ -625,9 +625,9 @@ text_property_to_utf8 (GetPropertyResults *results,
{
char *name;
meta_x11_error_trap_push (results->x11_display);
mtk_x11_error_trap_push (results->x11_display->xdisplay);
name = XGetAtomName (results->x11_display->xdisplay, results->xatom);
meta_x11_error_trap_pop (results->x11_display);
mtk_x11_error_trap_pop (results->x11_display->xdisplay);
meta_warning ("Property %s on window 0x%lx contained invalid UTF-8",
name, results->xwindow);
meta_XFree (name);