After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618371 - [plugin] Create ShellGlobal later to avoid connecting to X during build
[plugin] Create ShellGlobal later to avoid connecting to X during build
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2010-05-11 14:37 UTC by Colin Walters
Modified: 2010-05-17 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[plugin] Create ShellGlobal later to avoid connecting to X during build (2.27 KB, patch)
2010-05-11 14:37 UTC, Colin Walters
needs-work Details | Review
[plugin] Create ShellGlobal later to avoid connecting to X during build (4.31 KB, patch)
2010-05-11 14:51 UTC, Colin Walters
needs-work Details | Review
Create ShellGlobal later to avoid connecting to X during build (6.74 KB, patch)
2010-05-17 15:14 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2010-05-11 14:37:36 UTC
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 simply deferring creation of the ShellGlobal object
until the plugin is actually started.
Comment 1 Colin Walters 2010-05-11 14:37:38 UTC
Created attachment 160823 [details] [review]
[plugin] Create ShellGlobal later to avoid connecting to X during build
Comment 2 Colin Walters 2010-05-11 14:41:44 UTC
Comment on attachment 160823 [details] [review]
[plugin] Create ShellGlobal later to avoid connecting to X during build

Hm, this causes a panel regression...
Comment 3 Milan Bouchet-Valat 2010-05-11 14:48:24 UTC
Nice, that would also fix the GSettings issue where the program aborts if settings aren't installed yet.
Comment 4 Colin Walters 2010-05-11 14:51:15 UTC
Created attachment 160824 [details] [review]
[plugin] 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.
Comment 5 Owen Taylor 2010-05-14 17:28:44 UTC
Review of attachment 160824 [details] [review]:

::: src/shell-global.c
@@ +508,3 @@
+  meta_later_add (META_LATER_BEFORE_REDRAW,
+                  on_screen_size_changed_cb,
+                  global,

I was nodding along to this patch, until I got to this, which raised all sorts of questions:

 * Is this mentioned in your commit message?

   Maybe? is that what you meant by "initialize cached ShellGlobal 
   state at the point when the plugin is set."

 * How was the screen size changed cb being called before on startup?

   Turns out that Clutter will emit notify::height and notify::width
   for the stage on the first time the stage is size allocated.

 * Why would your patch change whether that happens or not?

   I can't see why it would. Was this added because it seemed necessary
   rather than you hit problems?

 * Is it bad to call on_screen_size_changed_cb as late as "BEFORE_REDRAW".

   Well, it's probably better than what happens now, which I think is that
   the frame is allocated, then the screen-size-changed signal is emitted
   before the *next* frame, triggering an immediate relayout/repaint. 
   Because of the signal connection to Main.js:_relayout() I think you might
   even see the panel hop from from one monitor to another.

 * How *should* this be done?

   I think we should:
 
    A) Set last_change_screen_width, last_change_screen_height here
    B) Do the initial sizing on the root pixmap actor when we create it
    C) Not emit screen-size-changed at startup
    D) Make Main.js:_start() call _relayout() explicitly.
Comment 6 Colin Walters 2010-05-17 15:14:06 UTC
Created attachment 161231 [details] [review]
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().
Comment 7 Colin Walters 2010-05-17 15:17:49 UTC
(updated for all comments)
Comment 8 Owen Taylor 2010-05-17 15:36:31 UTC
Review of attachment 161231 [details] [review]:

One problem, OK to commit with that fixed.

::: src/shell-global.c
@@ +461,3 @@
+
+  update_screen_size (global);
+  g_signal_emit (G_OBJECT (global), shell_global_signals[SCREEN_SIZE_CHANGED], 0);

Signal shouldn't be emitted unconditionally - this will cause _relayout() to happen *twice* on startup. make update_screen_size() return a 'changed' boolean.
Comment 9 Colin Walters 2010-05-17 17:04:59 UTC
Attachment 161231 [details] pushed as 84716bc - Create ShellGlobal later to avoid connecting to X during build