Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make X11 window span multiple monitors

I'm trying to use XResizeWindow() to make a window which will span 2 monitors, but the ?window manager? is limiting it to one.

Is there a hint or property I can associate with the window to tell the WM not to limit it?

For my test case, I have two 1600x1200 monitors that nVidia is presenting as one 3200x1200 screen to KDE4. XDisplayWidth(display, 0); returns 3200 and XDisplayHeight(display, 0); returns 1200.

When I call

XCreateWindow(display, DefaultRootWindow(display),
              220, 0, 1700, 930,
              1, DefaultDepth(display,screen),
              InputOutput, CopyFromParent,
              CWCursor, &attributes);

for a window 1700x930 at 220,0 I get a window 1593x930 at 0,0, keeping it entirely on the left monitor. Any XResizeWindow larger than that gets shrunk to 1593. (I assume the 7 pixels are window decoration, which is fine.)

But, if I then XMoveWindow(display, win, 800, 0), it will move the window to span the screens, and I can then enlarge it up to 3200 wide (minus a few pixels).

Is there anything I can do to tell the window manager, or whoever is doing this, not to limit the window to a single monitor, and let me use the entire screen?

Thanks!

%xrandr -q --verbose
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 3200 x 1200, current 3200 x 1200, maximum 3200 x 1200
default connected 3200x1200+0+0 (0x161) normal (normal) 0mm x 0mm
    Identifier: 0x160
    Timestamp:  64409661
    Subpixel:   unknown
    Clones:    
    CRTC:       0
    CRTCs:      0
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
3200x1200 (0x161)  192.0MHz *current
    h: width  3200 start    0 end    0 total 3200 skew    0 clock   60.0KHz
    v: height 1200 start    0 end    0 total 1200           clock   50.0Hz
like image 844
Ken Martin Avatar asked Jun 14 '13 18:06

Ken Martin


People also ask

How do I have a window span multiple monitors on macOS?

How do I have a window span multiple monitors on macOS? 1. Please open 'System Preferences' and select the 'Mission Control' preference pane, where you will see an option labeled 'Displays have separate Spaces' 2. When this checkbox is selected, OS X will snap a window to whichever display that window has the most area on

How to connect multiple monitors to Windows 11?

Before diving into these steps, connect the displays correctly, including the power and signal cables (HDMI or DisplayPort), and turn on all the monitors. Also, you want to make sure that Windows 11 is seeing all the monitors: Open Settings. Click on System. Click the Display page on the right side.

How do I rearrange multiple displays on Windows 11?

To rearrange multiple displays on Windows 11, use these steps: Open Settings. Click on System. Click the Display page on the right side. (Optional) Click the Identify button to determine which monitor you are actually rearranging. Drag and drop to rearrange each display according to their physical layout on the desktop.

How to maximize a window across multiple monitors?

How to Maximize a Window Across Multiple Monitors 1 Combining Displays With AMD Radeon Settings#N#If your computer has an AMD chip or uses a discrete AMD graphics card,... 2 Combining Displays With Dual Monitor Tools More ...


1 Answers

In general, an application should not try to rigidly control its window size and position, as WM is supposed to be smart and place the windows in the best possible fashion. If you want control anyway, try using XSizeHints like this:

XSizeHints sh;
sh.width = sh.min_width = 1700;
sh.height = sh.min_height = 930;
sh.h = 220;
sh.y = 0;
sh.flags = PSize | PMinSize | PPosition;
XSetWMNormalHints(dpy, win, &sh);
XMapWindow(dpy, win);

WMs will respect min_width and will not shrink the window smaller than this.

If you need a fullscreen window spanning multiple monitors, this is done differently, with _NET_WM_FULLSCREEN_MONITORS property. See here.

like image 91
n. 1.8e9-where's-my-share m. Avatar answered Oct 05 '22 14:10

n. 1.8e9-where's-my-share m.