mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
* Source/x11/XGServerWindow.m (boundsForScreen:): use screen
variable
to identify output in RandR screen resources. Use `boundsRect` local variable as return vaalue storage. Cleanup.
This commit is contained in:
parent
78a5f6a380
commit
b5c563a400
2 changed files with 12 additions and 7 deletions
|
@ -1,5 +1,9 @@
|
|||
2020-01-26 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/x11/XGServerWindow.m (boundsForScreen:): use `screen` variable
|
||||
to identify output in RandR screen resources. Use `boundsRect` local
|
||||
variable as return vaalue storage. Cleanup.
|
||||
|
||||
* Source/x11/XGServerEvent.m (processEvent:),
|
||||
* Source/x11/XGServer.m (_initXContext): catch and process RandR event
|
||||
on default screen.
|
||||
|
|
|
@ -4512,32 +4512,33 @@ _computeDepth(int class, int bpp)
|
|||
|
||||
- (NSRect) boundsForScreen: (int)screen
|
||||
{
|
||||
NSRect boundsRect = {{0,0},{0,0}};
|
||||
|
||||
if (screen < 0 || screen >= ScreenCount(dpy))
|
||||
{
|
||||
NSLog(@"Invalidparam: no screen %d", screen);
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
XRRScreenResources *screen_res;
|
||||
XRROutputInfo *output_info;
|
||||
NSRect boundsRect = {{0,0},{0,0}};
|
||||
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, screen));
|
||||
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[0]);
|
||||
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[screen]);
|
||||
if (output_info->crtc)
|
||||
{
|
||||
XRRCrtcInfo *crtc_info;
|
||||
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
|
||||
// NSLog(@"Screen bounds: %i,%i %ux%u",
|
||||
// crtc_info->x, crtc_info->y, crtc_info->width, crtc_info->height);
|
||||
boundsRect = NSMakeRect(crtc_info->x, crtc_info->y,
|
||||
crtc_info->width, crtc_info->height);
|
||||
}
|
||||
XRRFreeScreenResources(screen_res);
|
||||
return boundsRect;
|
||||
#else
|
||||
return NSMakeRect(0, 0, DisplayWidth(dpy, screen),
|
||||
DisplayHeight(dpy, screen));
|
||||
boundsRect = NSMakeRect(0, 0, DisplayWidth(dpy, screen),
|
||||
DisplayHeight(dpy, screen));
|
||||
#endif
|
||||
|
||||
return boundsRect;
|
||||
}
|
||||
|
||||
- (NSImage *) iconTileImage
|
||||
|
|
Loading…
Reference in a new issue