/* This function enables and disables the Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys, which (in XFree86 4.2) break any grabs and/or kill the grabbing client. That would effectively unlock the screen, so we don't like that. The Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys only exist if AllowDeactivateGrabs and/or AllowClosedownGrabs are turned on in XF86Config. I believe they are disabled by default. This does not affect any other keys (specifically Ctrl-Alt-BS or Ctrl-Alt-F1) but I wish it did. Maybe it will someday. */ static void xorg_lock_smasher_set_active (GSGrab *grab, gboolean active) { int status, event, error; #if GTK_CHECK_VERSION (3, 0, 0) if (!XF86MiscQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &event, &error)) #else if (!XF86MiscQueryExtension (GDK_DISPLAY (), &event, &error)) #endif { gs_debug ("No XFree86-Misc extension present"); return; } if (active) { gs_debug ("Enabling the x.org grab smasher"); } else { gs_debug ("Disabling the x.org grab smasher"); } gdk_error_trap_push (); #if GTK_CHECK_VERSION (3, 0, 0) status = XF86MiscSetGrabKeysState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), active); #else status = XF86MiscSetGrabKeysState (GDK_DISPLAY (), active); #endif gdk_display_sync (gdk_display_get_default ()); gdk_error_trap_pop (); if (active && status == MiscExtGrabStateAlready) { /* shut up, consider this success */ status = MiscExtGrabStateSuccess; } gs_debug ("XF86MiscSetGrabKeysState(%s) returned %s\n", active ? "on" : "off", (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" : status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" : status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" : "unknown value")); }
/* This function enables and disables the Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys, which (in XFree86 4.2) break any grabs and/or kill the grabbing client. That would effectively unlock the screen, so we don't like that. The Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys only exist if AllowDeactivateGrabs and/or AllowClosedownGrabs are turned on in XF86Config. I believe they are disabled by default. This does not affect any other keys (specifically Ctrl-Alt-BS or Ctrl-Alt-F1) but I wish it did. Maybe it will someday. */ static void xfree_lock_grab_smasher (saver_info *si, Bool lock_p) { saver_preferences *p = &si->prefs; int status; int event, error; XErrorHandler old_handler; if (!XF86MiscQueryExtension(si->dpy, &event, &error)) return; XSync (si->dpy, False); error_handler_hit_p = False; old_handler = XSetErrorHandler (ignore_all_errors_ehandler); XSync (si->dpy, False); status = XF86MiscSetGrabKeysState (si->dpy, !lock_p); XSync (si->dpy, False); if (error_handler_hit_p) status = 666; if (!lock_p && status == MiscExtGrabStateAlready) status = MiscExtGrabStateSuccess; /* shut up, consider this success */ if (p->verbose_p && status != MiscExtGrabStateSuccess) fprintf (stderr, "%s: error: XF86MiscSetGrabKeysState(%d) returned %s\n", blurb(), !lock_p, (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" : status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" : status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" : status == 666 ? "an X error" : "unknown value")); XSync (si->dpy, False); XSetErrorHandler (old_handler); XSync (si->dpy, False); }