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 704487 - display: prevent the built in display being turned on if the lid is closed
display: prevent the built in display being turned on if the lid is closed
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Display
unspecified
Other All
: Normal normal
: ---
Assigned To: Debarshi Ray
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-18 16:54 UTC by Thomas Wood
Modified: 2013-07-19 16:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
display: prevent the built in display being turned on if the lid is closed (4.12 KB, patch)
2013-07-18 16:55 UTC, Thomas Wood
needs-work Details | Review
display: prevent the built in display being turned on if the lid is closed (4.24 KB, patch)
2013-07-19 13:36 UTC, Thomas Wood
committed Details | Review

Description Thomas Wood 2013-07-18 16:54:59 UTC
If the laptop lid is closed and an external display is connected, it is
possible to turn on the laptop display and turn off the external display,
leaving the user without a visible display.
Comment 1 Thomas Wood 2013-07-18 16:55:02 UTC
Created attachment 249549 [details] [review]
display: prevent the built in display being turned on if the lid is closed
Comment 2 Bastien Nocera 2013-07-19 07:45:33 UTC
Review of attachment 249549 [details] [review]:

No need for the libgd changes in this patch.

::: panels/display/cc-display-panel.c
@@ +155,3 @@
 cc_display_panel_dispose (GObject *object)
 {
+  g_clear_object (&(CC_DISPLAY_PANEL (object))->priv->up_client);

Split this up into an assignment and your function call.

@@ +714,3 @@
         sensitive = FALSE;
 
+

whitespace change

@@ +2730,3 @@
+  self->priv->up_client = up_client_new ();
+  g_signal_connect (self->priv->up_client, "changed",
+                    G_CALLBACK (cc_display_panel_up_client_changed), self);

You'll want to set the current state here and avoid it altogether if up_client_get_lid_is_present() == FALSE.

Also, monitoring "notify::lid-is-closed" will stop it from rebuilding the list on every event.
Comment 3 Thomas Wood 2013-07-19 13:36:51 UTC
Created attachment 249628 [details] [review]
display: prevent the built in display being turned on if the lid is closed

Updated patch with suggested changes, except for using the
notify::lid-is-closed signal, which is currently only emitted when the UpClient
properties are explicitly synchronised. See
https://bugs.freedesktop.org/show_bug.cgi?id=43001 for more details.
Comment 4 Bastien Nocera 2013-07-19 13:39:10 UTC
Review of attachment 249628 [details] [review]:

Please mention the non use of notify::lid-is-closed in the commit message, and add a link to the bugzilla in the sources.

Looks good otherwise.
Comment 5 Thomas Wood 2013-07-19 16:20:52 UTC
Attachment 249628 [details] pushed to master and gnome-3-8. I added a comment to the
source code with the full details of the issue with the notify signal.