Create ShellGlobal later to avoid connecting to X during build
The ShellGlobal initialization performs several actions like connecting to the X server, ensuring directories exist, etc., that are problematic because we were creating the object even when running the binary for introspection scanning. During compilation we may not even have X11 available in e.g. autobuilder type environments, and it's just a bad idea to connect even if we do. Avoid this by deferring creation of the ShellGlobal object until the plugin is actually started. Now that we're initializing things later, remove the connection to screen changes, and initialize cached ShellGlobal state at the point when the plugin is set. The root pixmap actor is now sized initially on creation too. Instead of relying on screen-size-changed being emitted on startup, explicitly invoke _relayout(). https://bugzilla.gnome.org/show_bug.cgi?id=618371
This commit is contained in:
parent
f438ccfc53
commit
84716bccd4
@ -167,6 +167,9 @@ function start() {
|
|||||||
// Install magnifier.
|
// Install magnifier.
|
||||||
magnifier = new Magnifier.Magnifier();
|
magnifier = new Magnifier.Magnifier();
|
||||||
|
|
||||||
|
// Perform initial relayout here
|
||||||
|
_relayout();
|
||||||
|
|
||||||
_log('info', 'loaded at ' + _startDate);
|
_log('info', 'loaded at ' + _startDate);
|
||||||
log('GNOME Shell started at ' + _startDate);
|
log('GNOME Shell started at ' + _startDate);
|
||||||
|
|
||||||
|
@ -140,8 +140,6 @@ gnome_shell_plugin_class_init (GnomeShellPluginClass *klass)
|
|||||||
static void
|
static void
|
||||||
gnome_shell_plugin_init (GnomeShellPlugin *shell_plugin)
|
gnome_shell_plugin_init (GnomeShellPlugin *shell_plugin)
|
||||||
{
|
{
|
||||||
_shell_global_set_plugin (shell_global_get(), MUTTER_PLUGIN(shell_plugin));
|
|
||||||
|
|
||||||
meta_prefs_override_preference_location ("/apps/metacity/general/button_layout",
|
meta_prefs_override_preference_location ("/apps/metacity/general/button_layout",
|
||||||
"/desktop/gnome/shell/windows/button_layout");
|
"/desktop/gnome/shell/windows/button_layout");
|
||||||
}
|
}
|
||||||
@ -245,6 +243,7 @@ gnome_shell_plugin_start (MutterPlugin *plugin)
|
|||||||
int status;
|
int status;
|
||||||
const char *shell_js;
|
const char *shell_js;
|
||||||
char **search_path;
|
char **search_path;
|
||||||
|
ShellGlobal *global;
|
||||||
|
|
||||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
@ -275,7 +274,11 @@ gnome_shell_plugin_start (MutterPlugin *plugin)
|
|||||||
shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path);
|
shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path);
|
||||||
g_strfreev(search_path);
|
g_strfreev(search_path);
|
||||||
|
|
||||||
_shell_global_set_gjs_context (shell_global_get (), shell_plugin->gjs_context);
|
/* Initialize the global object here. */
|
||||||
|
global = shell_global_get ();
|
||||||
|
|
||||||
|
_shell_global_set_plugin (global, MUTTER_PLUGIN(shell_plugin));
|
||||||
|
_shell_global_set_gjs_context (global, shell_plugin->gjs_context);
|
||||||
|
|
||||||
if (!gjs_context_eval (shell_plugin->gjs_context,
|
if (!gjs_context_eval (shell_plugin->gjs_context,
|
||||||
"const Main = imports.ui.main; Main.start();",
|
"const Main = imports.ui.main; Main.start();",
|
||||||
|
@ -436,25 +436,34 @@ shell_global_get_windows (ShellGlobal *global)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
on_screen_size_changed_cb (gpointer data)
|
update_screen_size (ShellGlobal *global)
|
||||||
{
|
{
|
||||||
ShellGlobal *global = SHELL_GLOBAL (data);
|
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
mutter_plugin_query_screen_size (global->plugin, &width, &height);
|
mutter_plugin_query_screen_size (global->plugin, &width, &height);
|
||||||
|
|
||||||
if (global->last_change_screen_width != width || global->last_change_screen_height != height)
|
if (global->last_change_screen_width == width && global->last_change_screen_height == height)
|
||||||
{
|
return FALSE;
|
||||||
g_signal_emit (G_OBJECT (global), shell_global_signals[SCREEN_SIZE_CHANGED], 0);
|
|
||||||
global->last_change_screen_width = width;
|
global->last_change_screen_width = width;
|
||||||
global->last_change_screen_height = height;
|
global->last_change_screen_height = height;
|
||||||
|
|
||||||
/* update size of background actor to fix tiled backgrounds */
|
/* update size of background actor to fix tiled backgrounds */
|
||||||
|
if (global->root_pixmap)
|
||||||
clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
|
clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
on_screen_size_changed_cb (gpointer data)
|
||||||
|
{
|
||||||
|
ShellGlobal *global = SHELL_GLOBAL (data);
|
||||||
|
|
||||||
|
if (update_screen_size (global))
|
||||||
|
g_signal_emit (G_OBJECT (global), shell_global_signals[SCREEN_SIZE_CHANGED], 0);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,37 +497,25 @@ global_stage_notify_height (GObject *gobject,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
global_plugin_notify_screen (GObject *gobject,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
ShellGlobal *global = SHELL_GLOBAL (data);
|
|
||||||
ClutterActor *stage = mutter_plugin_get_stage (MUTTER_PLUGIN (gobject));
|
|
||||||
|
|
||||||
g_signal_connect (stage, "notify::width",
|
|
||||||
G_CALLBACK (global_stage_notify_width), global);
|
|
||||||
g_signal_connect (stage, "notify::height",
|
|
||||||
G_CALLBACK (global_stage_notify_height), global);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_shell_global_set_plugin (ShellGlobal *global,
|
_shell_global_set_plugin (ShellGlobal *global,
|
||||||
MutterPlugin *plugin)
|
MutterPlugin *plugin)
|
||||||
{
|
{
|
||||||
|
ClutterActor *stage;
|
||||||
|
|
||||||
g_return_if_fail (SHELL_IS_GLOBAL (global));
|
g_return_if_fail (SHELL_IS_GLOBAL (global));
|
||||||
g_return_if_fail (global->plugin == NULL);
|
g_return_if_fail (global->plugin == NULL);
|
||||||
|
|
||||||
global->plugin = plugin;
|
global->plugin = plugin;
|
||||||
global->wm = shell_wm_new (plugin);
|
global->wm = shell_wm_new (plugin);
|
||||||
|
|
||||||
/* At this point screen is NULL, so we can't yet do signal connections
|
stage = mutter_plugin_get_stage (plugin);
|
||||||
* to the width and height; we wait until the screen property is set
|
|
||||||
* to do that. Note that this is a one time thing - screen will never
|
g_signal_connect (stage, "notify::width",
|
||||||
* change once first set.
|
G_CALLBACK (global_stage_notify_width), global);
|
||||||
*/
|
g_signal_connect (stage, "notify::height",
|
||||||
g_signal_connect (plugin, "notify::screen",
|
G_CALLBACK (global_stage_notify_height), global);
|
||||||
G_CALLBACK (global_plugin_notify_screen), global);
|
update_screen_size (global);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1023,6 +1020,10 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
|||||||
{
|
{
|
||||||
global->root_pixmap = clutter_glx_texture_pixmap_new ();
|
global->root_pixmap = clutter_glx_texture_pixmap_new ();
|
||||||
|
|
||||||
|
clutter_actor_set_size (CLUTTER_ACTOR (global->root_pixmap),
|
||||||
|
global->last_change_screen_width,
|
||||||
|
global->last_change_screen_height);
|
||||||
|
|
||||||
clutter_texture_set_repeat (CLUTTER_TEXTURE (global->root_pixmap),
|
clutter_texture_set_repeat (CLUTTER_TEXTURE (global->root_pixmap),
|
||||||
TRUE, TRUE);
|
TRUE, TRUE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user