x11: Call grab functions directly

... instead of going via vfuncs.
This commit is contained in:
Benjamin Otte 2013-02-10 01:24:28 +01:00
parent eb4792128f
commit 7800e68b73
3 changed files with 5 additions and 60 deletions

View File

@ -1609,22 +1609,6 @@ gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
return FALSE;
}
static void
refcounted_grab_server (Display *xdisplay)
{
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
gdk_x11_display_grab (display);
}
static void
refcounted_ungrab_server (Display *xdisplay)
{
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
gdk_x11_display_ungrab (display);
}
static GdkFilterReturn
gdk_xsettings_client_event_filter (GdkXEvent *xevent,
GdkEvent *event,
@ -1734,9 +1718,7 @@ _gdk_x11_screen_init_events (GdkScreen *screen)
x11_screen->xsettings_client = xsettings_client_new (screen,
gdk_xsettings_notify_cb,
gdk_xsettings_watch_cb,
screen,
refcounted_grab_server,
refcounted_ungrab_server);
screen);
x11_screen->xsettings_in_init = FALSE;
}

View File

@ -45,9 +45,6 @@ struct _XSettingsClient
XSettingsWatchFunc watch;
void *cb_data;
XSettingsGrabFunc grab;
XSettingsGrabFunc ungrab;
Window manager_window;
Atom manager_atom;
Atom selection_atom;
@ -418,10 +415,7 @@ check_manager_window (XSettingsClient *client)
if (client->manager_window && client->watch)
client->watch (client->manager_window, False, 0, client->cb_data);
if (client->grab)
client->grab (client->display);
else
XGrabServer (client->display);
gdk_x11_display_grab (gdk_screen_get_display (client->screen));
client->manager_window = XGetSelectionOwner (client->display,
client->selection_atom);
@ -429,10 +423,7 @@ check_manager_window (XSettingsClient *client)
XSelectInput (client->display, client->manager_window,
PropertyChangeMask | StructureNotifyMask);
if (client->ungrab)
client->ungrab (client->display);
else
XUngrabServer (client->display);
gdk_x11_display_ungrab (gdk_screen_get_display (client->screen));
XFlush (client->display);
@ -458,9 +449,7 @@ XSettingsClient *
xsettings_client_new (GdkScreen *screen,
XSettingsNotifyFunc notify,
XSettingsWatchFunc watch,
void *cb_data,
XSettingsGrabFunc grab,
XSettingsGrabFunc ungrab)
void *cb_data)
{
XSettingsClient *client;
char buffer[256];
@ -476,8 +465,6 @@ xsettings_client_new (GdkScreen *screen,
client->notify = notify;
client->watch = watch;
client->cb_data = cb_data;
client->grab = grab;
client->ungrab = ungrab;
client->manager_window = None;
client->settings = NULL;
@ -505,21 +492,6 @@ xsettings_client_new (GdkScreen *screen,
return client;
}
void
xsettings_client_set_grab_func (XSettingsClient *client,
XSettingsGrabFunc grab)
{
client->grab = grab;
}
void
xsettings_client_set_ungrab_func (XSettingsClient *client,
XSettingsGrabFunc ungrab)
{
client->ungrab = ungrab;
}
void
xsettings_client_destroy (XSettingsClient *client)
{

View File

@ -35,8 +35,6 @@ extern "C" {
#define xsettings_client_destroy _gdk_x11_xsettings_client_destroy
#define xsettings_client_get_setting _gdk_x11_xsettings_client_get_setting
#define xsettings_client_new _gdk_x11_xsettings_client_new
#define xsettings_client_set_grab_func _gdk_x11_xsettings_client_set_grab_func
#define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func
#define xsettings_client_process_event _gdk_x11_xsettings_client_process_event
#define xsettings_setting_equal _gdk_x11_xsettings_setting_equal
#define xsettings_setting_free _gdk_x11_xsettings_setting_free
@ -106,7 +104,6 @@ typedef Bool (*XSettingsWatchFunc) (Window window,
Bool is_start,
long mask,
void *cb_data);
typedef void (*XSettingsGrabFunc) (Display *display);
void xsettings_setting_free (XSettingsSetting *setting);
int xsettings_setting_equal (XSettingsSetting *setting_a,
@ -115,13 +112,7 @@ int xsettings_setting_equal (XSettingsSetting *setting_
XSettingsClient *xsettings_client_new (GdkScreen *screen,
XSettingsNotifyFunc notify,
XSettingsWatchFunc watch,
void *cb_data,
XSettingsGrabFunc grab,
XSettingsGrabFunc ungrab);
void xsettings_client_set_grab_func (XSettingsClient *client,
XSettingsGrabFunc grab);
void xsettings_client_set_ungrab_func (XSettingsClient *client,
XSettingsGrabFunc ungrab);
void *cb_data);
void xsettings_client_destroy (XSettingsClient *client);
Bool xsettings_client_process_event (XSettingsClient *client,
XEvent *xev);