diff options
Diffstat (limited to 'src/core/screen.c')
-rw-r--r-- | src/core/screen.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/core/screen.c b/src/core/screen.c index 6c555126..66461d4a 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -485,6 +485,8 @@ meta_screen_new (MetaDisplay *display, screen->wm_sn_timestamp = manager_timestamp; #ifdef HAVE_COMPOSITE_EXTENSIONS + g_snprintf (buf, sizeof(buf), "_NET_WM_CM_S%d", screen->number); + screen->wm_cm_atom = XInternAtom (screen->display->xdisplay, buf, FALSE); screen->wm_cm_selection_window = meta_create_offscreen_window (xdisplay, xroot, NoEventMask); @@ -1508,7 +1510,7 @@ meta_screen_tile_preview_update_timeout (gpointer data) MetaRectangle tile_rect; meta_window_get_current_tile_area (window, &tile_rect); - meta_tile_preview_show (screen->tile_preview, &tile_rect); + meta_tile_preview_show (screen->tile_preview, &tile_rect, screen); } else meta_tile_preview_hide (screen->tile_preview); @@ -2894,28 +2896,25 @@ meta_screen_set_compositor_data (MetaScreen *screen, void meta_screen_set_cm_selection (MetaScreen *screen) { - char selection[32]; - Atom a; - screen->wm_cm_timestamp = meta_display_get_current_time_roundtrip ( screen->display); - g_snprintf (selection, sizeof(selection), "_NET_WM_CM_S%d", screen->number); - meta_verbose ("Setting selection: %s\n", selection); - a = XInternAtom (screen->display->xdisplay, selection, FALSE); - XSetSelectionOwner (screen->display->xdisplay, a, + meta_verbose ("Setting selection for screen: %d\n", screen->number); + XSetSelectionOwner (screen->display->xdisplay, screen->wm_cm_atom, screen->wm_cm_selection_window, screen->wm_cm_timestamp); } void meta_screen_unset_cm_selection (MetaScreen *screen) { - char selection[32]; - Atom a; - - g_snprintf (selection, sizeof(selection), "_NET_WM_CM_S%d", screen->number); - a = XInternAtom (screen->display->xdisplay, selection, FALSE); - XSetSelectionOwner (screen->display->xdisplay, a, + XSetSelectionOwner (screen->display->xdisplay, screen->wm_cm_atom, None, screen->wm_cm_timestamp); } + +gboolean +meta_screen_is_cm_selected (MetaScreen *screen) +{ + Window owner = XGetSelectionOwner (screen->display->xdisplay, screen->wm_cm_atom); + return owner != None; +} #endif /* HAVE_COMPOSITE_EXTENSIONS */ |