My monitor configuration is listed at the end of this email post.
My problem:
    can not get each monitor's width & height widh xlib.
here is my code:
----------------------------------------------------------
hacksign@XSign [16:51:41] : ~/Code/XSTest
>> make
gcc XScreenWidth.c -lX11 -o test
hacksign@XSign [16:51:41] : ~/Code/XSTest
>> ./test
Screen Width:4480    Screen Height:1440
Screen count:1
hacksign@XSign [16:51:43] : ~/Code/XSTest
>> cat XScreenWidth.c
#include <X11/Xlib.h>
#include <stdio.h>

int main(int argc, char** argv){
    const char* dp_name = ":0.0";
    Display* dp = XOpenDisplay(dp_name);
    int screen_num = DefaultScreen(dp);
    Screen* pScreen = ScreenOfDisplay(dp, screen_num);
printf("Screen Width:%d\tScreen Height:%d\n", pScreen->width, pScreen->height);
    int screen_count = ScreenCount(dp);
    printf("Screen count:%d\n", screen_count);
    XCloseDisplay(dp);
    return 0;
}
----------------------------------------------------------
and the xrandr output:
----------------------------------------------------------
hacksign@XSign [16:51:47] : ~/Code/XSTest
>> xrandr
Screen 0: minimum 8 x 8, current 4480 x 1440, maximum 32767 x 32767
eDP1 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 310mm x 174mm
   2560x1440     60.00*+
   1920x1440     60.00
   1856x1392     60.01
   .........
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 connected 1920x1080+2560+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+  59.94
   1280x1024     75.02    60.02
   ...........
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
----------------------------------------------------------
I just got the monitor0's width + monitor1's width.
How can I get something like this :
monitor[0].width = 2560
 monitor[1].width = 1920 ?
-----------------------------------------------------------
X11 monitor configuration:
-----------------------------------------------------------
Section "Module"
    Load  "glx"
EndSection

Section "Monitor"
    Identifier "Monitor0"
    DisplaySize 541 304
    Option        "DPMS"
    Option      "Primary" "true"
EndSection

Section "Monitor"
    Identifier "Monitor1"
    DisplaySize 508 285
    Option         "DPMS"
    Option         "RightOf" "Monitor0"
    Option      "Primary" "false"
EndSection

Section "Device"
    Identifier     "Card0"
    Driver      "intel"
    BusID         "PCI:0:2:0"
    Option         "ZaphodHeads" "eDP1,DP1,DP2,HDMI1,HDMI2"
    #Option         "AccelMethod" "uxa"
    Option         "AccelMethod" "sna"
    Option "monitor-eDP1" "Monitor0"
    Option "monitor-HDMI2" "Monitor1"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor         "Monitor0"
    SubSection "Display"
        Depth 24
        Modes "2560x1440" "1920x1080" "1024x768" "800x600"
    EndSubsection
EndSection

Section "ServerLayout"
    Identifier         "default"
    Screen             0 "Screen0" 0 0
EndSection
_______________________________________________
[email protected]: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

Reply via email to