summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/keybindings.c14
-rw-r--r--src/core/prefs.c61
-rw-r--r--src/core/screen-private.h1
-rw-r--r--src/core/screen.c31
-rw-r--r--src/core/window.c1
5 files changed, 56 insertions, 52 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.