interrobang icon indicating copy to clipboard operation
interrobang copied to clipboard

Multiscreen: respect primary output

Open lahwaacz opened this issue 11 years ago • 3 comments

I don't like the suggestion from #21 much, the Xrandr extension allows setting primary output, which I think is to solve exactly the problem of static geometry configurations.

The solution which works quite well for me is to query the primary output, set the default position to (output->x, output->y) instead of (0,0) and set the default window width to the width of the output instead of the full screen:

...
#include <X11/extensions/Xrandr.h>
...

XRRScreenResources* res = XRRGetScreenResources(dpy, root);
RROutput output = XRRGetOutputPrimary(dpy, root);
if (output != 0) {
    XRROutputInfo* output_info = XRRGetOutputInfo(dpy, res, output);
    if (output_info->connection == RR_Connected && output_info->crtc != 0) {
        XRRCrtcInfo* crtc_info = XRRGetCrtcInfo (dpy, res, output_info->crtc);
        x += crtc_info->x;
        y += crtc_info->y;
        w = (w ? w : crtc_info->width);
        XRRFreeCrtcInfo(crtc_info);
    }
    XRRFreeOutputInfo(output_info);
}
XRRFreeScreenResources(res);

...

The part I haven't thought of yet is the behaviour of special (negative) values passed to geometry, which move the default position to the centre of the full screen. On the other hand when default position is not unconditionally (0,0), negative values make sense even for moving the position.

It would be nice to have this implemented in interrobang, even if not as a default option.

lahwaacz avatar Apr 12 '15 10:04 lahwaacz

I'm travelling currently and will be very busy over the next month, so I may not get to this. But I'm not sure I really want to add code for this. The negative values for centering would still be easy - and I've linked against XRandr in another project, but I am hesitant to do so here. However, an opt-in conditional compile should be pretty easy to do, so I'll put that on the todo list.

TrilbyWhite avatar Apr 12 '15 23:04 TrilbyWhite

I'm not sure how my problem fits in here, but I'm having a problem with interrobang switching its output to my secondary monitor on HDMI-0. My primary monitor is on DVI-D-0 and as soon as I activate the second monitor interrobang output switches to it. It seems to me that interrobang should not change its output monitor by default, but only when directed to do so. Can you fix this please?

Jemi avatar Dec 15 '18 20:12 Jemi

If you don't specify a geometry, interrobang uses the default screen (as per X11's DefaultScreen macro). If you do specify the geometry, the coordinates are in the root window. So either you are not setting the geometry and your screen configuration has your HDMI output as the default screen, or you are setting the geometry but the HDMI ouput is to the left or above the DVI output (in which case you'd need to adjust your geometry settings).

TrilbyWhite avatar Dec 17 '18 15:12 TrilbyWhite