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 677472 - display switch hotkey doesn't work when monitor starts in clone mode
display switch hotkey doesn't work when monitor starts in clone mode
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: xrandr
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
: 667672 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-06-05 14:22 UTC by Ray Strode [halfline]
Modified: 2013-04-24 13:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
xrandr: explicitly set clone state variable when generating monitor configs (2.16 KB, patch)
2012-06-05 14:34 UTC, Ray Strode [halfline]
committed Details | Review

Description Ray Strode [halfline] 2012-06-05 14:22:52 UTC
A downstream reporter wrote on https://bugzilla.redhat.com/show_bug.cgi?id=824757 that display hotkey switching wasn't reliable for him.

Relevant comments:

MaricoXu 2012-05-24 03:54:58 EDT

Description of problem:
when the user try to use the hot key (depend on the system , some is Fn+F8,and some is Fn+F4), the xinerama configuration will not show, and sometimes other display wrong issue will happen.

Actual results:
the xinerama configuration will not show or the switch operation cannot work. and sometimes

Expected result:
the four switch operations(clone,xinerama,laptop,extern) should work succcessfully

The Code Change can fix the issue:
       (1) libxrandr.so :
           code change:  in the function make_xinerama_setup()  (gsd-xrandr-managers.c)
          gnome version>3.0
            add gnome_rr_config_set_clone(result ,0); to the end of this function.
         gnome version<3.0
           add result->clone=false; to the end of this function. 

           When the user is doing the hotkey switch operation first time, gnome will call make_**_setup() function to setup the configurations for the future use.
However the original logic in gnome-settings-daemon didn’t deal with the clone flag well.  The clone flag should be set as false in the xinerama case.



Ray Strode [halfline] 2012-06-04 16:03:10 EDT

So to clarify comment 0, gnome-settings-daemon does something like the following pseudocode when constructing the list of of possible output configurations to cycle through when the user presses fn-f7:

generate_fn_f7_configs (...) {
   configs = new array;

   configs += current_setup();
   configs += make_clone_setup();
   configs += make_xinerama_setup();
   configs += make_laptop_setup();
   configs += make_other_setup();
   configs += previously_saved_to_disk_setup();

   remove_duplicate_configs (configs);

   fn_f7_configs = configs;
}

each of these make_..._setup() functions starts with a copy of the current setup, that they tweak until it fits the characteristics of the desired config. So, for example, make_xinerama_setup will start with a current config, and then position the configuration offsets of the outputs so they are side-by-side. 

If the current configuration is cloned at the time generate_fn_f7_configs is called, the config->clone will be set to TRUE, and every generated config will have config->clone=TRUE since those config generation functions don't explicitly set it to a value that makes sense for their particular configs.

Later, when the user presses, fn-f7, gnome-settings-daemon cycles through and applies the next config in the array using the gnome-rr apis.  the gnome-rr code then does this, as part of applying the configuration, then looks at the clone property:

make_outputs(config) {
    for (each output in config.outputs) {
        if (config->clone) {
          /* ignore output width/height and just use geometry of first output for all outputs*/
          output.width = config.outputs[0].width
          output.height = config.outputs[0].height
          output.rotation = config.outputs[0].rotation
          output.x = config.outputs[0].x;
          output.y = config.outputs[0].y;
        }
    } 
}

So these make_..._setup functions carefully placed the monitors to fit their desired layout, but neglected to change clone appropriately, then the presence of clone causes those carefullly placed monitors to get overridden with a clone setup.

Note, setting config->clone is an accepted part of the gnome-rr api.  control-center does it when the user toggles "mirror screens", and the reporter is correct, gnome-settings-daemon should set it as well in its make_..._setup functions.
Comment 1 Ray Strode [halfline] 2012-06-05 14:34:47 UTC
Created attachment 215646 [details] [review]
xrandr: explicitly set clone state variable when generating monitor configs

Each potential monitor configuration that can be cycled through with
fn-f7 on laptops is generated by copying and tweaking the current
monitor configuration.

One necessary, but neglected tweak, was the current "clone" state.  This
means the clone state of the current configuration leaks into every
other config. Users who start in a cloned mode can never leave a clone
with the hotkey.

This commit explicitly sets the clone state appropriately.

Patch based on valuable, and detailed feedback provided by Marico Xu.
Comment 2 Ray Strode [halfline] 2012-06-05 14:36:04 UTC
Attachment 215646 [details] pushed as 5f76438 - xrandr: explicitly set clone state variable when generating monitor configs
Comment 3 Ray Strode [halfline] 2012-06-05 14:37:04 UTC
(pushed after talking with federico on IRC)
Comment 4 Bastien Nocera 2013-04-24 13:09:39 UTC
*** Bug 667672 has been marked as a duplicate of this bug. ***