static gboolean mnb_notification_gtk_click_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { MutterPlugin *plugin = dawati_netbook_get_plugin_singleton (); MetaScreen *screen = mutter_plugin_get_screen (plugin); MetaDisplay *display = meta_screen_get_display (screen); MetaWindow *mw = NULL; gboolean fullscreen = FALSE; g_debug ("Got click on widget %s", G_OBJECT_TYPE_NAME (widget)); g_object_get (display, "focus-window", &mw, NULL); if (!mw) { g_warning (G_STRLOC " Could not obtain currently focused window!"); return TRUE; } g_object_get (mw, "fullscreen", &fullscreen, NULL); if (!fullscreen) { g_warning (G_STRLOC " Currently focused window is not fullscreen!"); return TRUE; } meta_window_unmake_fullscreen (mw); return TRUE; }
/** * shell_global_grab_keyboard: * @global: a #ShellGlobal * * Grab the keyboard to the stage window. The stage will receive * all keyboard events until shell_global_ungrab_keyboard() is called. * This is appropriate to do when the desktop goes into a special * mode where no normal global key shortcuts or application keyboard * processing should happen. */ gboolean shell_global_grab_keyboard (ShellGlobal *global) { MetaScreen *screen = mutter_plugin_get_screen (global->plugin); MetaDisplay *display = meta_screen_get_display (screen); Display *xdisplay = meta_display_get_xdisplay (display); ClutterStage *stage = CLUTTER_STAGE (mutter_plugin_get_stage (global->plugin)); Window stagewin = clutter_x11_get_stage_window (stage); /* FIXME: we need to coordinate with the rest of Metacity or we * may grab the keyboard away from other portions of Metacity * and leave Metacity in a confused state. An X client is allowed * to overgrab itself, though not allowed to grab they keyboard * away from another applications. */ if (global->keyboard_grabbed) return FALSE; if (XGrabKeyboard (xdisplay, stagewin, False, /* owner_events - steal events from the rest of metacity */ GrabModeAsync, GrabModeAsync, CurrentTime) != Success) return FALSE; /* probably AlreadyGrabbed, some other app has a keyboard grab */ global->keyboard_grabbed = TRUE; return TRUE; }
/** * shell_global_display_is_grabbed * @global: a #ShellGlobal * * Determines whether Mutter currently has a grab (keyboard or mouse or * both) on the display. This could be the result of a current window * management operation like a window move, or could be from * shell_global_begin_modal(). * * This function is useful to for ad-hoc checks to avoid over-grabbing * the Mutter grab a grab from GTK+. Longer-term we might instead want a * mechanism to make Mutter use GDK grabs instead of raw XGrabPointer(). * * Return value: %TRUE if Mutter has a grab on the display */ gboolean shell_global_display_is_grabbed (ShellGlobal *global) { MetaScreen *screen = mutter_plugin_get_screen (global->plugin); MetaDisplay *display = meta_screen_get_display (screen); return meta_display_get_grab_op (display) != META_GRAB_OP_NONE; }
/** * shell_global_ungrab_keyboard: * @global: a #ShellGlobal * * Undoes the effect of shell_global_grab_keyboard */ void shell_global_ungrab_keyboard (ShellGlobal *global) { MetaScreen *screen; MetaDisplay *display; Display *xdisplay; g_return_if_fail (global->keyboard_grabbed); screen = mutter_plugin_get_screen (global->plugin); display = meta_screen_get_display (screen); xdisplay = meta_display_get_xdisplay (display); XUngrabKeyboard (xdisplay, CurrentTime); global->keyboard_grabbed = FALSE; }
/** * shell_global_set_stage_input_region: * @global: the #ShellGlobal * @rectangles: (element-type Meta.Rectangle): a list of #MetaRectangle * describing the input region. * * Sets the area of the stage that is responsive to mouse clicks when * the stage mode is %SHELL_STAGE_INPUT_MODE_NORMAL (but does not change the * current stage mode). */ void shell_global_set_stage_input_region (ShellGlobal *global, GSList *rectangles) { MetaScreen *screen = mutter_plugin_get_screen (global->plugin); MetaDisplay *display = meta_screen_get_display (screen); Display *xdpy = meta_display_get_xdisplay (display); MetaRectangle *rect; XRectangle *rects; int nrects, i; GSList *r; g_return_if_fail (SHELL_IS_GLOBAL (global)); nrects = g_slist_length (rectangles); rects = g_new (XRectangle, nrects); for (r = rectangles, i = 0; r; r = r->next, i++) { rect = (MetaRectangle *)r->data; rects[i].x = rect->x; rects[i].y = rect->y; rects[i].width = rect->width; rects[i].height = rect->height; } if (global->input_region) XFixesDestroyRegion (xdpy, global->input_region); global->input_region = XFixesCreateRegion (xdpy, rects, nrects); g_free (rects); /* set_stage_input_mode() will figure out whether or not we * should actually change the input region right now. */ shell_global_set_stage_input_mode (global, global->input_mode); }
/** * shell_global_get_screen: * * Return value: (transfer none): The default #MetaScreen */ MetaScreen * shell_global_get_screen (ShellGlobal *global) { return mutter_plugin_get_screen (global->plugin); }