diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/keybindings.c | 14 | ||||
-rw-r--r-- | src/core/prefs.c | 61 | ||||
-rw-r--r-- | src/core/screen-private.h | 1 | ||||
-rw-r--r-- | src/core/screen.c | 31 | ||||
-rw-r--r-- | src/core/window.c | 1 | ||||
-rw-r--r-- | src/include/screen.h | 1 | ||||
-rw-r--r-- | src/include/tile-preview.h | 9 | ||||
-rw-r--r-- | src/ui/preview-widget.c | 4 | ||||
-rw-r--r-- | src/ui/tile-preview.c | 34 |
9 files changed, 81 insertions, 75 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c index c52fe3b8..9e602a91 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2321,7 +2321,7 @@ static void error_on_command (int command_index, const char *command, const char *message, - int screen_number, + const char *screen_name, guint32 timestamp) { if (command_index < 0) @@ -2350,7 +2350,7 @@ error_on_command (int command_index, meta_show_dialog ("--error", text, NULL, - screen_number, + screen_name, NULL, NULL, 0, NULL, NULL); @@ -2362,7 +2362,7 @@ error_on_command (int command_index, meta_show_dialog ("--error", message, NULL, - screen_number, + screen_name, NULL, NULL, 0, NULL, NULL); } @@ -2433,7 +2433,7 @@ handle_run_command (MetaDisplay *display, s = g_strdup_printf (_("No command %d has been defined.\n"), which + 1); - error_on_command (which, NULL, s, screen->number, event->xkey.time); + error_on_command (which, NULL, s, screen->screen_name, event->xkey.time); g_free (s); return; @@ -2442,7 +2442,7 @@ handle_run_command (MetaDisplay *display, err = NULL; if (!meta_spawn_command_line_async_on_screen (command, screen, &err)) { - error_on_command (which, command, err->message, screen->number, event->xkey.time); + error_on_command (which, command, err->message, screen->screen_name, event->xkey.time); g_error_free (err); } @@ -3443,7 +3443,7 @@ handle_run_terminal (MetaDisplay *display, "keybinding press\n"); s = g_strdup_printf (_("No terminal command has been defined.\n")); - error_on_command (-1, NULL, s, screen->number, event->xkey.time); + error_on_command (-1, NULL, s, screen->screen_name, event->xkey.time); g_free (s); return; @@ -3452,7 +3452,7 @@ handle_run_terminal (MetaDisplay *display, err = NULL; if (!meta_spawn_command_line_async_on_screen (command, screen, &err)) { - error_on_command (-1, command, err->message, screen->number, + error_on_command (-1, command, err->message, screen->screen_name, event->xkey.time); g_error_free (err); diff --git a/src/core/prefs.c b/src/core/prefs.c index 8847614e..8fa28b83 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -162,7 +162,9 @@ static void button_layout_handler (MetaPreference, const gchar*, gboolean*); static gboolean update_binding (MetaKeyPref *binding, gchar *value); -static void init_bindings (void); +static void init_bindings (GSettings *); +static void init_screen_bindings (void); +static void init_window_bindings (void); static void init_commands (void); static void init_workspace_names (void); @@ -890,13 +892,6 @@ meta_prefs_init (void) g_hash_table_insert (settings_schemas, KEY_MATE_TERMINAL_SCHEMA, settings_mate_terminal); g_hash_table_insert (settings_schemas, KEY_MATE_MOUSE_SCHEMA, settings_mate_mouse); - /* Pick up initial values. */ - - handle_preference_init_enum (); - handle_preference_init_bool (); - handle_preference_init_string (); - handle_preference_init_int (); - g_signal_connect (settings_general, "changed", G_CALLBACK (change_notify), NULL); g_signal_connect (settings_command, "changed", G_CALLBACK (change_notify), NULL); g_signal_connect (settings_screen_bindings, "changed", G_CALLBACK (change_notify), NULL); @@ -909,7 +904,15 @@ meta_prefs_init (void) g_signal_connect (settings_mate_mouse, "changed::" KEY_MATE_MOUSE_CURSOR_THEME, G_CALLBACK (change_notify), NULL); g_signal_connect (settings_mate_mouse, "changed::" KEY_MATE_MOUSE_CURSOR_SIZE, G_CALLBACK (change_notify), NULL); - init_bindings (); + /* Pick up initial values. */ + + handle_preference_init_enum (); + handle_preference_init_bool (); + handle_preference_init_string (); + handle_preference_init_int (); + + init_screen_bindings (); + init_window_bindings (); init_commands (); init_workspace_names (); } @@ -972,7 +975,7 @@ change_notify (GSettings *settings, g_free(str); } - else if (g_strcmp0 (schema_name, KEY_WORKSPACE_NAME_SCHEMA)) + else if (g_strcmp0 (schema_name, KEY_WORKSPACE_NAME_SCHEMA) == 0) { gchar *str; str = g_settings_get_string (settings, key); @@ -1582,32 +1585,32 @@ static MetaKeyPref key_bindings[] = { #undef keybind static void -init_bindings (void) +init_bindings (GSettings *settings) { - const char *prefix[] = { - KEY_WINDOW_BINDINGS_SCHEMA, - KEY_SCREEN_BINDINGS_SCHEMA, - NULL - }; - int i; gchar **list = NULL; gchar *str_val = NULL; - GSettings *bindings_settings = NULL; - for (i = 0; prefix[i]; i++) + list = g_settings_list_keys (settings); + while (*list != NULL) { - bindings_settings = g_settings_new (prefix [i]); - list = g_settings_list_keys (bindings_settings); - while (*list != NULL) - { - str_val = g_settings_get_string (bindings_settings, *list); - update_key_binding (*list, str_val); - list++; - } + str_val = g_settings_get_string (settings, *list); + update_key_binding (*list, str_val); + list++; } + g_free (str_val); - g_object_unref (bindings_settings); +} +static void +init_screen_bindings (void) +{ + init_bindings (settings_screen_bindings); +} + +static void +init_window_bindings (void) +{ + init_bindings (settings_window_bindings); } static void @@ -1623,6 +1626,7 @@ init_commands (void) update_command (*list, str_val); list++; } + g_free (str_val); } @@ -1639,6 +1643,7 @@ init_workspace_names (void) update_workspace_name (*list, str_val); list++; } + g_free (str_val); } diff --git a/src/core/screen-private.h b/src/core/screen-private.h index 0103c6ad..ee014ff2 100644 --- a/src/core/screen-private.h +++ b/src/core/screen-private.h @@ -115,6 +115,7 @@ struct _MetaScreen #endif #ifdef HAVE_COMPOSITE_EXTENSIONS + Atom wm_cm_atom; Window wm_cm_selection_window; guint32 wm_cm_timestamp; #endif diff --git a/src/core/screen.c b/src/core/screen.c index bd3667e8..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); @@ -1475,14 +1477,12 @@ meta_screen_tile_preview_update_timeout (gpointer data) { MetaScreen *screen = data; MetaWindow *window = screen->display->grab_window; - gboolean composited = screen->display->compositor != NULL; gboolean needs_preview = FALSE; screen->tile_preview_timeout_id = 0; if (!screen->tile_preview) - screen->tile_preview = meta_tile_preview_new (screen->number, - composited); + screen->tile_preview = meta_tile_preview_new (screen->number); if (window) { @@ -1510,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); @@ -2896,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 */ diff --git a/src/core/window.c b/src/core/window.c index 6f5a5fe0..9b2ad926 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -3319,6 +3319,7 @@ send_sync_request (MetaWindow *window) ev.data.l[1] = meta_display_get_current_time (window->display); ev.data.l[2] = XSyncValueLow32 (value); ev.data.l[3] = XSyncValueHigh32 (value); + ev.data.l[4] = 0; /* We don't need to trap errors here as we are already * inside an error_trap_push()/pop() pair. diff --git a/src/include/screen.h b/src/include/screen.h index 759c1fd2..34f4d008 100644 --- a/src/include/screen.h +++ b/src/include/screen.h @@ -43,6 +43,7 @@ MetaScreen *meta_screen_for_x_screen (Screen *xscreen); #ifdef HAVE_COMPOSITE_EXTENSIONS void meta_screen_set_cm_selection (MetaScreen *screen); void meta_screen_unset_cm_selection (MetaScreen *screen); +gboolean meta_screen_is_cm_selected (MetaScreen *screen); #endif #endif diff --git a/src/include/tile-preview.h b/src/include/tile-preview.h index b0ca3b01..70ceec9e 100644 --- a/src/include/tile-preview.h +++ b/src/include/tile-preview.h @@ -24,14 +24,15 @@ #define META_TILE_PREVIEW_H #include "boxes.h" +#include "types.h" typedef struct _MetaTilePreview MetaTilePreview; -MetaTilePreview *meta_tile_preview_new (int screen_number, - gboolean composited); +MetaTilePreview *meta_tile_preview_new (int screen_number); void meta_tile_preview_free (MetaTilePreview *preview); void meta_tile_preview_show (MetaTilePreview *preview, - MetaRectangle *rect); + MetaRectangle *rect, + MetaScreen *screen); void meta_tile_preview_hide (MetaTilePreview *preview); -#endif /* META_TILE_PREVIEW_H */
\ No newline at end of file +#endif /* META_TILE_PREVIEW_H */ diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 58122706..da8593d4 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -620,7 +620,7 @@ meta_preview_get_icon (void) NULL); else default_icon = gtk_icon_theme_load_icon (theme, - "gtk-missing-image", + "image-missing", META_ICON_WIDTH, 0, NULL); @@ -653,7 +653,7 @@ meta_preview_get_mini_icon (void) NULL); else default_icon = gtk_icon_theme_load_icon (theme, - "gtk-missing-image", + "image-missing", META_MINI_ICON_WIDTH, 0, NULL); diff --git a/src/ui/tile-preview.c b/src/ui/tile-preview.c index 71b2e297..ee58600d 100644 --- a/src/ui/tile-preview.c +++ b/src/ui/tile-preview.c @@ -28,6 +28,8 @@ #include "tile-preview.h" #include "core.h" +#include "types.h" +#include "core/screen-private.h" #define OUTLINE_WIDTH 5 /* frame width in non-composite case */ @@ -177,8 +179,7 @@ on_preview_window_style_set (GtkWidget *widget, } MetaTilePreview * -meta_tile_preview_new (int screen_number, - gboolean composited) +meta_tile_preview_new (int screen_number) { MetaTilePreview *preview; #if !GTK_CHECK_VERSION (3, 0, 0) @@ -207,23 +208,14 @@ meta_tile_preview_new (int screen_number, preview->tile_rect.width = preview->tile_rect.height = 0; #if GTK_CHECK_VERSION (3, 0, 0) - preview->has_alpha = composited && (gdk_screen_get_rgba_visual (screen) != NULL); + gtk_widget_set_visual (preview->preview_window, + gdk_screen_get_rgba_visual (screen)); #else - preview->has_alpha = rgba_colormap && composited; + gtk_widget_set_colormap (preview->preview_window, rgba_colormap); #endif - if (preview->has_alpha) - { -#if GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_set_visual (preview->preview_window, - gdk_screen_get_rgba_visual (screen)); -#else - gtk_widget_set_colormap (preview->preview_window, rgba_colormap); -#endif - - g_signal_connect (preview->preview_window, "style-set", - G_CALLBACK (on_preview_window_style_set), preview); - } + g_signal_connect (preview->preview_window, "style-set", + G_CALLBACK (on_preview_window_style_set), preview); gtk_widget_realize (preview->preview_window); #if !GTK_CHECK_VERSION (3, 0, 0) @@ -259,7 +251,8 @@ meta_tile_preview_free (MetaTilePreview *preview) void meta_tile_preview_show (MetaTilePreview *preview, - MetaRectangle *tile_rect) + MetaRectangle *tile_rect, + MetaScreen *screen) { GdkWindow *window; GdkRectangle old_rect; @@ -292,6 +285,11 @@ meta_tile_preview_show (MetaTilePreview *preview, gdk_window_move_resize (window, preview->tile_rect.x, preview->tile_rect.y, preview->tile_rect.width, preview->tile_rect.height); +#if HAVE_COMPOSITE_EXTENSIONS + preview->has_alpha = meta_screen_is_cm_selected (screen); +#else + preview->has_alpha = FALSE; +#endif if (!preview->has_alpha) { @@ -338,6 +336,8 @@ meta_tile_preview_show (MetaTilePreview *preview, gdk_window_shape_combine_region (window, outer_region, 0, 0); gdk_region_destroy (outer_region); #endif + } else { + gdk_window_shape_combine_region (window, NULL, 0, 0); } } |