* Source/x11/XGServerWindow.m (screenList): Transform screen

origin into unflipped (OpenStep) coordinate system for XRandR capable
  systems. After this change windows and screen will use the same start
  of coordinate system for their origins.
This commit is contained in:
Sergii Stoian 2020-02-11 18:21:34 +02:00
parent 519d267d60
commit 9c4f9ce7fc
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2020-02-11 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (screenList): Transform screen
origin into unflipped (OpenStep) coordinate system for XRandR capable
systems. After this change windows and screen will use the same start
of coordinate system for their origins.
2020-02-07 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (_XFrameToOSFrame:for:): use Xlib

View file

@ -4464,6 +4464,8 @@ _computeDepth(int class, int bpp)
XRROutputInfo *output_info;
XRRCrtcInfo *crtc_info;
int mi;
NSRect frame;
int xScreenHeight = DisplayHeight(dpy, defScreen);
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, defScreen));
if (screen_res != NULL)
@ -4483,8 +4485,13 @@ _computeDepth(int class, int bpp)
monitors[mi].screen_id = defScreen;
monitors[mi].depth = [self windowDepthForScreen: mi];
monitors[mi].resolution = [self resolutionForScreen: defScreen];
monitors[mi].frame = NSMakeRect(crtc_info->x, crtc_info->y,
crtc_info->width, crtc_info->height);
/* Transform coordinates from Xlib (flipped) to OpenStep (unflippped).
Windows and screens should have the same coordinate system. */
frame = NSMakeRect(crtc_info->x,
xScreenHeight - crtc_info->height - crtc_info->y,
crtc_info->width,
crtc_info->height);
monitors[mi].frame = frame;
/* Add monitor ID (index in monitors array).
Put primary monitor ID index 0 since NSScreen get this as main
screen if application has no key window. */