mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
* gswindow_device_t
structure element screen
was renamed to
`screen_id`; `monitor_id` element was added. Made use of `screen_id` and `monitor_id` where it's appropriate. * Removed `screen` parameter from methods which contains it in name. Methods were renamed to remove `Screen` and `FromScreen`. * Source/x11/XGServerWindow.m (screenList): change with assumption that Xlib screen is one per application. Failback code to RandR-related always creates arrays with one element (no enumeration needed). Create `monitor` structure in failback (non-RandR) code. Use `screen_id` MonitorDevice structure element to hold Xlib screen ID. (windowDepthForScreen:): assume that `screen` parameter is a Xlib screen ID, simplify code - `screen` will be used with RandR or not. (availableDepthsForScreen:): changed with assumption that `screen` is a index of element in `monitors` structure. * Source/x11/XGServer.m (_initXContext): initialize `monitors` array early here before first use (calls to XGServerWindow methods).
This commit is contained in:
parent
3e53e04c58
commit
c1ab242c9e
11 changed files with 278 additions and 204 deletions
71
ChangeLog
71
ChangeLog
|
@ -1,3 +1,74 @@
|
|||
2020-02-03 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/x11/XWindowBuffer.m (windowBufferForWindow:depthInfo:): use
|
||||
renamed XGServer's `screenVisual` and `screenDepth` methods.
|
||||
|
||||
* Source/x11/XIMInputServer.m (initWithDelegate:name:):
|
||||
use `+xDisplay` instead of `xCurrentDisplay`.
|
||||
(clientWindowRect:): ditto.
|
||||
|
||||
* Headers/x11/XGServerWindow.h (_gswindow_device_t):
|
||||
renamed `screen` to `screen_id`. `monitor_id` element was added -
|
||||
this is an index of element in MonitorDevice array.
|
||||
* Source/x11/XGServerWindow.m:
|
||||
Removed `screen` parameter from methods which contains it in name.
|
||||
Methods were renamed to remove `Screen` and `FromScreen`.
|
||||
(_OSFrameToXFrame:for:): use `monitor_id` instead of `screen`.
|
||||
(_OSFrameToXHints:for:): ditto.
|
||||
(_XFrameToOSFrame:for:): ditto.
|
||||
(_checkStyle:): use renamed methods and `screen_id` window structure
|
||||
element.
|
||||
(_rootWindow): renamed from _rootWindowForScreen:, use `defScreen`
|
||||
instead of removed parameter `screen`, set window structure element
|
||||
`monitor_id` to 0.
|
||||
(_createBuffer:): use `screen_id` window structure.
|
||||
(window::::): use renamed methods, `defScreen`, `screen_id` and
|
||||
`monitor_id` window scructure elements.
|
||||
(nativeWindow:::::): ditto.
|
||||
(setbackgroundcolor::): ditto.
|
||||
(miniwindow:): ditto.
|
||||
(_createAppIconPixmaps): removed unused `screen` local variable, use
|
||||
renamed `screenRContext` method.
|
||||
(orderwindow:::): use `screen_id` window structure element.
|
||||
(movewindow::): use `screen_id` window structure element as a parameter
|
||||
to `boundsForScreen`.
|
||||
(windowbounds:): ditto.
|
||||
(windowlist): use renamed `_rootWindow` method.
|
||||
(setMouseLocation:onScreen:): user renamed methods.
|
||||
(_blankCursor): ditto.
|
||||
(imagecursor:::): ditto
|
||||
(recolorcursor:::): ditto.
|
||||
(screenList): change with assumption that Xlib screen is one per application.
|
||||
Failback code to RandR-related always creates arrays with one element (no
|
||||
enumeration needed). Create `monitor` structure in failback (non-RandR) code.
|
||||
Use `screen_id` MonitorDevice structure element to hold Xlib screen ID.
|
||||
(windowDepthForScreen:): assume that `screen` parameter is a Xlib screen ID,
|
||||
simplify code - `screen` will be used with RandR or not.
|
||||
(availableDepthsForScreen:): changed with assumption that `screen` is a index
|
||||
of element in `monitors` structure.
|
||||
|
||||
* Source/x11/XGServerEvent.m:
|
||||
use renamed methods and `screen_id` window structure element.
|
||||
|
||||
* Headers/x11/XGServer.h
|
||||
Removed `screen` parameter from methods which contains it in name.
|
||||
Methods were renamed to remove `Screen` and `FromScreen`.
|
||||
(MonitorDevice): `screen_id` was added.
|
||||
|
||||
* Source/x11/XGServer.m:
|
||||
use `screen_id` and rename mathods according to XGServer,h.
|
||||
(_initXContext): initialize `monitors` array early here before first
|
||||
use (calls to XGServerWindow methods).
|
||||
|
||||
* Source/x11/XGDragView.m (XDPY): use `monitor_id` in `boundForScreen:`
|
||||
call.
|
||||
|
||||
* Source/cairo/XGCairoSurface.m: use `xDisplayRootWindow` XGServer's method.
|
||||
|
||||
* Source/art/ARTContext.m (setupDrawInfo:): use `xDisplayRootWindow`
|
||||
XGServer's method.
|
||||
|
||||
|
||||
2020-01-31 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Source/x11/XGServerWindow.m (screenList): join RandR and non-RandR
|
||||
|
|
|
@ -53,6 +53,7 @@ typedef enum {
|
|||
} XGDrawMechanism;
|
||||
|
||||
typedef struct MonitorDevice {
|
||||
int screen_id;
|
||||
NSWindowDepth depth;
|
||||
NSSize resolution;
|
||||
NSRect frame;
|
||||
|
@ -72,19 +73,19 @@ typedef struct MonitorDevice {
|
|||
unsigned monitorsCount;
|
||||
}
|
||||
|
||||
+ (Display*) currentXDisplay;
|
||||
- (Display*) xDisplay;
|
||||
+ (Display *) xDisplay;
|
||||
- (Display *) xDisplay;
|
||||
- (Window) xDisplayRootWindow;
|
||||
- (Window) xAppRootWindow;
|
||||
|
||||
- (void *) xrContextForScreen: (int)screen_number;
|
||||
- (Visual *) visualForScreen: (int)screen_number;
|
||||
- (int) depthForScreen: (int)screen_number;
|
||||
- (void *) screenRContext;
|
||||
- (Visual *) screenVisual;
|
||||
- (int) screenDepth;
|
||||
- (XGDrawMechanism) screenDrawMechanism;
|
||||
|
||||
- (XGDrawMechanism) drawMechanismForScreen: (int)screen_number;
|
||||
- (void) getForScreen: (int)screen_number pixelFormat: (int *)bpp_number
|
||||
masks: (int *)red_mask : (int *)green_mask : (int *)blue_mask;
|
||||
- (Window) xDisplayRootWindowForScreen: (int)screen_number;
|
||||
- (XColor) xColorFromColor: (XColor)color forScreen: (int)screen_number;
|
||||
- (XColor) xColorFromColor: (XColor)color;
|
||||
|
||||
+ (void) waitAllContexts;
|
||||
@end
|
||||
|
|
|
@ -84,8 +84,9 @@ typedef struct _gswindow_device_t {
|
|||
Display *display; /* Display this window is on */
|
||||
Window ident; /* Window handle */
|
||||
Window root; /* Handle of root window */
|
||||
Window parent; /* Handle of parent window */
|
||||
int screen; /* Screeen this window is on */
|
||||
Window parent; /* Handle of parent window */
|
||||
int screen_id; /* Screeen this window is on */
|
||||
int monitor_id; /* Physical monitor this window is on */
|
||||
GC gc; /* GC for drawing */
|
||||
long number; /* Globally unique identifier */
|
||||
unsigned int depth; /* Window depth */
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
gswindow_device_t *gs_win;
|
||||
|
||||
gs_win = device;
|
||||
[(XGServer *)server getForScreen: gs_win->screen pixelFormat: &bpp
|
||||
[(XGServer *)server getForScreen: gs_win->screen_id pixelFormat: &bpp
|
||||
masks: &red_mask : &green_mask : &blue_mask];
|
||||
#endif
|
||||
artcontext_setup_draw_info(&DI, red_mask, green_mask, blue_mask, bpp);
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
Window win;
|
||||
XWindowAttributes attrs;
|
||||
|
||||
win = [self xDisplayRootWindowForScreen: screen];
|
||||
win = [self xDisplayRootWindow];
|
||||
|
||||
if (XGetWindowAttributes(dpy, win, &attrs))
|
||||
{
|
||||
|
|
|
@ -47,14 +47,14 @@
|
|||
/* Size of the dragged window */
|
||||
#define DWZ 48
|
||||
|
||||
#define XDPY [XGServer currentXDisplay]
|
||||
#define XDPY [XGServer xDisplay]
|
||||
|
||||
#define SLIDE_TIME_STEP .02 /* in seconds */
|
||||
#define SLIDE_NR_OF_STEPS 20
|
||||
|
||||
#define DRAGWINDEV [XGServer _windowWithTag: [_window windowNumber]]
|
||||
#define XX(P) (P.x)
|
||||
#define XY(P) ([GSCurrentServer() boundsForScreen: DRAGWINDEV->screen].size.height - P.y)
|
||||
#define XY(P) ([GSCurrentServer() boundsForScreen: DRAGWINDEV->monitor_id].size.height - P.y)
|
||||
|
||||
@interface XGRawWindow : NSWindow
|
||||
@end
|
||||
|
|
|
@ -141,7 +141,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
XGDrawMechanism drawMechanism;
|
||||
}
|
||||
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_number;
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_id;
|
||||
- (XGDrawMechanism) drawMechanism;
|
||||
- (RContext *) context;
|
||||
@end
|
||||
|
@ -173,7 +173,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
return attribs;
|
||||
}
|
||||
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_number
|
||||
- initForDisplay: (Display *)dpy screen: (int)screen_id
|
||||
{
|
||||
RContextAttributes *attribs;
|
||||
XColor testColor;
|
||||
|
@ -182,7 +182,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
/* Get the visual information */
|
||||
attribs = NULL;
|
||||
//attribs = [self _getXDefaults];
|
||||
rcontext = RCreateContext(dpy, screen_number, attribs);
|
||||
rcontext = RCreateContext(dpy, screen_id, attribs);
|
||||
|
||||
/*
|
||||
* If we have shared memory available, only use it when the XGPS-Shm
|
||||
|
@ -291,7 +291,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
drawMechanism = XGDM_PORTABLE;
|
||||
}
|
||||
NSDebugLLog(@"XGTrace", @"Draw mech %d for screen %d", drawMechanism,
|
||||
screen_number);
|
||||
screen_id);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -377,14 +377,14 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
Returns a pointer to the current X-Windows display variable for
|
||||
the current context.
|
||||
*/
|
||||
+ (Display*) currentXDisplay
|
||||
+ (Display *) xDisplay
|
||||
{
|
||||
return [(XGServer*)GSCurrentServer() xDisplay];
|
||||
}
|
||||
|
||||
- (id) _initXContext
|
||||
{
|
||||
int screen_number, display_number;
|
||||
int screen_id, display_id;
|
||||
NSString *display_name;
|
||||
|
||||
display_name = [server_info objectForKey: GSDisplayName];
|
||||
|
@ -436,13 +436,13 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
}
|
||||
|
||||
/* Parse display information */
|
||||
_parse_display_name(display_name, &display_number, &screen_number);
|
||||
_parse_display_name(display_name, &display_id, &screen_id);
|
||||
NSDebugLog(@"Opened display %@, display %d screen %d",
|
||||
display_name, display_number, screen_number);
|
||||
display_name, display_id, screen_id);
|
||||
[server_info setObject: display_name forKey: GSDisplayName];
|
||||
[server_info setObject: [NSNumber numberWithInt: display_number]
|
||||
[server_info setObject: [NSNumber numberWithInt: display_id]
|
||||
forKey: GSDisplayNumber];
|
||||
[server_info setObject: [NSNumber numberWithInt: screen_number]
|
||||
[server_info setObject: [NSNumber numberWithInt: screen_id]
|
||||
forKey: GSScreenNumber];
|
||||
|
||||
/* Setup screen*/
|
||||
|
@ -450,7 +450,11 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
screenList = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 20);
|
||||
|
||||
defScreen = screen_number;
|
||||
defScreen = screen_id;
|
||||
|
||||
/* Enumerate monitors */
|
||||
if (monitors == NULL)
|
||||
[self screenList];
|
||||
|
||||
XSetErrorHandler(XGErrorHandler);
|
||||
|
||||
|
@ -519,46 +523,57 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
return dpy;
|
||||
}
|
||||
|
||||
- (XGScreenContext *) _screenContextForScreen: (int)screen_number
|
||||
/**
|
||||
Returns the root window of the display
|
||||
*/
|
||||
- (Window) xDisplayRootWindow;
|
||||
{
|
||||
int count = ScreenCount(dpy);
|
||||
XGScreenContext *screen;
|
||||
|
||||
if (screen_number >= count)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Request for invalid screen"];
|
||||
}
|
||||
|
||||
screen = NSMapGet(screenList, (void *)(uintptr_t)screen_number);
|
||||
if (screen == NULL)
|
||||
{
|
||||
screen = [[XGScreenContext alloc]
|
||||
initForDisplay: dpy screen: screen_number];
|
||||
NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen);
|
||||
RELEASE(screen);
|
||||
}
|
||||
|
||||
return screen;
|
||||
return RootWindow(dpy, defScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the application root window, which is used for many things
|
||||
such as window hints
|
||||
*/
|
||||
- (Window) xAppRootWindow
|
||||
{
|
||||
return generic.appRootWindow;
|
||||
}
|
||||
|
||||
- (XGScreenContext *) _defaultScreenContext
|
||||
{
|
||||
XGScreenContext *screenCtxt;
|
||||
|
||||
screenCtxt = NSMapGet(screenList, (void *)(uintptr_t)defScreen);
|
||||
if (screenCtxt == NULL)
|
||||
{
|
||||
screenCtxt = [[XGScreenContext alloc] initForDisplay: dpy
|
||||
screen: defScreen];
|
||||
NSMapInsert(screenList, (void *)(uintptr_t)defScreen, (void *)screenCtxt);
|
||||
RELEASE(screenCtxt);
|
||||
}
|
||||
|
||||
return screenCtxt;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns a pointer to a structure which describes aspects of the
|
||||
X windows display
|
||||
*/
|
||||
- (void *) xrContextForScreen: (int)screen_number
|
||||
- (void *) screenRContext
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] context];
|
||||
return [[self _defaultScreenContext] context];
|
||||
}
|
||||
|
||||
- (Visual *) visualForScreen: (int)screen_number
|
||||
- (Visual *) screenVisual
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] context]->visual;
|
||||
return [[self _defaultScreenContext] context]->visual;
|
||||
}
|
||||
|
||||
- (int) depthForScreen: (int)screen_number
|
||||
- (int) screenDepth
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] context]->depth;
|
||||
return [[self _defaultScreenContext] context]->depth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -566,9 +581,9 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
the screen and how pixels should be drawn to the screen for maximum
|
||||
speed.
|
||||
*/
|
||||
- (XGDrawMechanism) drawMechanismForScreen: (int)screen_number
|
||||
- (XGDrawMechanism) screenDrawMechanism
|
||||
{
|
||||
return [[self _screenContextForScreen: screen_number] drawMechanism];
|
||||
return [[self _defaultScreenContext] drawMechanism];
|
||||
}
|
||||
|
||||
// Could use NSSwapInt() instead
|
||||
|
@ -600,48 +615,48 @@ static int byte_order(void)
|
|||
/**
|
||||
* Used by the art backend to determine the drawing mechanism.
|
||||
*/
|
||||
- (void) getForScreen: (int)screen_number pixelFormat: (int *)bpp_number
|
||||
- (void) getForScreen: (int)screen_id pixelFormat: (int *)bpp_number
|
||||
masks: (int *)red_mask : (int *)green_mask : (int *)blue_mask
|
||||
{
|
||||
Visual *visual;
|
||||
XImage *i;
|
||||
int bpp;
|
||||
#if 0
|
||||
XVisualInfo template;
|
||||
XVisualInfo *visualInfo;
|
||||
int numMatches;
|
||||
// #if 0
|
||||
// XVisualInfo template;
|
||||
// XVisualInfo *visualInfo;
|
||||
// int numMatches;
|
||||
|
||||
/*
|
||||
We need a visual that we can generate pixel values for by ourselves.
|
||||
Thus, we try to find a DirectColor or TrueColor visual. If that fails,
|
||||
we use the default visual and hope that it's usable.
|
||||
*/
|
||||
template.class = DirectColor;
|
||||
visualInfo = XGetVisualInfo(dpy, VisualClassMask, &template, &numMatches);
|
||||
if (!visualInfo)
|
||||
{
|
||||
template.class = TrueColor;
|
||||
visualInfo = XGetVisualInfo(dpy, VisualClassMask, &template, &numMatches);
|
||||
}
|
||||
if (visualInfo)
|
||||
{
|
||||
visual = visualInfo->visual;
|
||||
bpp = visualInfo->depth;
|
||||
XFree(visualInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
visual = DefaultVisual(dpy, DefaultScreen(dpy));
|
||||
bpp = DefaultDepth(dpy, DefaultScreen(dpy));
|
||||
}
|
||||
#else
|
||||
// /*
|
||||
// We need a visual that we can generate pixel values for by ourselves.
|
||||
// Thus, we try to find a DirectColor or TrueColor visual. If that fails,
|
||||
// we use the default visual and hope that it's usable.
|
||||
// */
|
||||
// template.class = DirectColor;
|
||||
// visualInfo = XGetVisualInfo(dpy, VisualClassMask, &template, &numMatches);
|
||||
// if (!visualInfo)
|
||||
// {
|
||||
// template.class = TrueColor;
|
||||
// visualInfo = XGetVisualInfo(dpy, VisualClassMask, &template, &numMatches);
|
||||
// }
|
||||
// if (visualInfo)
|
||||
// {
|
||||
// visual = visualInfo->visual;
|
||||
// bpp = visualInfo->depth;
|
||||
// XFree(visualInfo);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// visual = DefaultVisual(dpy, DefaultScreen(dpy));
|
||||
// bpp = DefaultDepth(dpy, DefaultScreen(dpy));
|
||||
// }
|
||||
// #else
|
||||
RContext *context;
|
||||
|
||||
// Better to get the used visual from the context.
|
||||
context = [self xrContextForScreen: screen_number];
|
||||
context = [self screenRContext];
|
||||
visual = context->visual;
|
||||
bpp = context->depth;
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
i = XCreateImage(dpy, visual, bpp, ZPixmap, 0, NULL, 8, 8, 8, 0);
|
||||
bpp = i->bits_per_pixel;
|
||||
|
@ -677,44 +692,28 @@ static int byte_order(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the root window of the display
|
||||
*/
|
||||
- (Window) xDisplayRootWindowForScreen: (int)screen_number;
|
||||
{
|
||||
return RootWindow(dpy, screen_number);
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the closest color in the current colormap to the indicated
|
||||
X color
|
||||
*/
|
||||
- (XColor) xColorFromColor: (XColor)color forScreen: (int)screen_number
|
||||
- (XColor) xColorFromColor: (XColor)color
|
||||
{
|
||||
Status ret;
|
||||
RColor rcolor;
|
||||
RContext *context = [self xrContextForScreen: screen_number];
|
||||
RContext *context = [self screenRContext];
|
||||
XAllocColor(dpy, context->cmap, &color);
|
||||
rcolor.red = color.red / 256;
|
||||
rcolor.green = color.green / 256;
|
||||
rcolor.blue = color.blue / 256;
|
||||
ret = RGetClosestXColor(context, &rcolor, &color);
|
||||
if (ret == False)
|
||||
NSLog(@"Failed to alloc color (%d,%d,%d)\n",
|
||||
(int)rcolor.red, (int)rcolor.green, (int)rcolor.blue);
|
||||
{
|
||||
NSLog(@"Failed to alloc color (%d,%d,%d)\n",
|
||||
(int)rcolor.red, (int)rcolor.green, (int)rcolor.blue);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns the application root window, which is used for many things
|
||||
such as window hints
|
||||
*/
|
||||
- (Window) xAppRootWindow
|
||||
{
|
||||
return generic.appRootWindow;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Wait for all contexts to finish processing. Only used with XDPS graphics.
|
||||
*/
|
||||
|
@ -805,7 +804,6 @@ static int byte_order(void)
|
|||
|
||||
@end // XGServer (InputMethod)
|
||||
|
||||
|
||||
//==== Additional code for NSTextView =========================================
|
||||
//
|
||||
// WARNING This section is not genuine part of the XGServer implementation.
|
||||
|
@ -823,6 +821,9 @@ static int byte_order(void)
|
|||
#include <AppKit/NSClipView.h>
|
||||
#include <AppKit/NSTextView.h>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
|
||||
|
||||
@implementation NSTextView (InputMethod)
|
||||
|
||||
- (void) _updateInputMethodState
|
||||
|
@ -935,4 +936,6 @@ static int byte_order(void)
|
|||
}
|
||||
|
||||
@end // NSTextView
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
//==== End: Additional Code for NSTextView ====================================
|
||||
|
|
|
@ -744,7 +744,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
else if ((Atom)xEvent.xclient.data.l[0]
|
||||
== generic._NET_WM_PING_ATOM)
|
||||
{
|
||||
xEvent.xclient.window = RootWindow(dpy, cWin->screen);
|
||||
xEvent.xclient.window = RootWindow(dpy, cWin->screen_id);
|
||||
XSendEvent(dpy, xEvent.xclient.window, False,
|
||||
(SubstructureRedirectMask | SubstructureNotifyMask),
|
||||
&xEvent);
|
||||
|
@ -796,7 +796,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
send ConfigureNotify events for app icons.
|
||||
*/
|
||||
XTranslateCoordinates(dpy, xEvent.xclient.window,
|
||||
RootWindow(dpy, cWin->screen),
|
||||
RootWindow(dpy, cWin->screen_id),
|
||||
0, 0,
|
||||
&root_x, &root_y,
|
||||
&root_child);
|
||||
|
@ -965,7 +965,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
int root_x, root_y;
|
||||
Window root_child;
|
||||
XTranslateCoordinates(dpy, xEvent.xconfigure.window,
|
||||
RootWindow(dpy, cWin->screen),
|
||||
RootWindow(dpy, cWin->screen_id),
|
||||
0, 0,
|
||||
&root_x, &root_y,
|
||||
&root_child);
|
||||
|
@ -2066,7 +2066,7 @@ static void
|
|||
initialize_keyboard (void)
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
Display *display = [XGServer currentXDisplay];
|
||||
Display *display = [XGServer xDisplay];
|
||||
|
||||
// Below must be stored and checked as keysyms, not keycodes, since
|
||||
// more than one keycode may be mapped t the same keysym
|
||||
|
@ -2140,7 +2140,7 @@ set_up_num_lock (void)
|
|||
ShiftMask, LockMask, ControlMask, Mod1Mask,
|
||||
Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask
|
||||
};
|
||||
Display *display = [XGServer currentXDisplay];
|
||||
Display *display = [XGServer xDisplay];
|
||||
KeyCode _num_lock_keycode;
|
||||
|
||||
// Get NumLock keycode
|
||||
|
@ -2668,10 +2668,9 @@ process_modifier_flags(unsigned int state)
|
|||
BOOL ok;
|
||||
NSPoint p;
|
||||
int height;
|
||||
int screen_number;
|
||||
|
||||
screen_number = (screen >= 0) ? screen : defScreen;
|
||||
ok = XQueryPointer (dpy, [self xDisplayRootWindowForScreen: screen_number],
|
||||
int screen_id;
|
||||
|
||||
ok = XQueryPointer (dpy, [self xDisplayRootWindow],
|
||||
&rootWin, &childWin, ¤tX, ¤tY, &winX, &winY, &mask);
|
||||
p = NSMakePoint(-1,-1);
|
||||
if (ok == False)
|
||||
|
@ -2683,8 +2682,8 @@ process_modifier_flags(unsigned int state)
|
|||
{
|
||||
return p;
|
||||
}
|
||||
screen_number = XScreenNumberOfScreen(attribs.screen);
|
||||
if (screen >= 0 && screen != screen_number)
|
||||
screen_id = XScreenNumberOfScreen(attribs.screen);
|
||||
if (screen >= 0 && screen != screen_id)
|
||||
{
|
||||
/* Mouse not on the requred screen, return an invalid point */
|
||||
return p;
|
||||
|
@ -2692,7 +2691,7 @@ process_modifier_flags(unsigned int state)
|
|||
height = attribs.height;
|
||||
}
|
||||
else
|
||||
height = [self boundsForScreen: screen_number].size.height;
|
||||
height = [self boundsForScreen: screen].size.height;
|
||||
p = NSMakePoint(currentX, height - currentY);
|
||||
if (win)
|
||||
{
|
||||
|
|
|
@ -444,7 +444,7 @@ BOOL AtomPresentAndPointsToItself(Display *dpy, Atom atom, Atom type)
|
|||
}
|
||||
|
||||
@interface XGServer (WindowOps)
|
||||
- (gswindow_device_t *) _rootWindowForScreen: (int)screen;
|
||||
- (gswindow_device_t *) _rootWindow;
|
||||
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
|
||||
: (unsigned int) style : (Window) win;
|
||||
- (void) _setSupportedWMProtocols: (gswindow_device_t *) window;
|
||||
|
@ -509,7 +509,7 @@ BOOL AtomPresentAndPointsToItself(Display *dpy, Atom atom, Atom type)
|
|||
x.size.height = o.size.height - t - b;
|
||||
x.origin.x = o.origin.x + l;
|
||||
x.origin.y = o.origin.y + o.size.height - t;
|
||||
x.origin.y = [self boundsForScreen: win->screen].size.height - x.origin.y;
|
||||
x.origin.y = [self boundsForScreen: win->monitor_id].size.height - x.origin.y;
|
||||
NSDebugLLog(@"Frame", @"O2X %lu, %x, %@, %@", win->number, style,
|
||||
NSStringFromRect(o), NSStringFromRect(x));
|
||||
return x;
|
||||
|
@ -534,7 +534,7 @@ BOOL AtomPresentAndPointsToItself(Display *dpy, Atom atom, Atom type)
|
|||
x.size.height = o.size.height - t - b;
|
||||
x.origin.x = o.origin.x;
|
||||
x.origin.y = o.origin.y + o.size.height;
|
||||
x.origin.y = [self boundsForScreen: win->screen].size.height - x.origin.y;
|
||||
x.origin.y = [self boundsForScreen: win->monitor_id].size.height - x.origin.y;
|
||||
NSDebugLLog(@"Frame", @"O2H %lu, %x, %@, %@", win->number, style,
|
||||
NSStringFromRect(o), NSStringFromRect(x));
|
||||
return x;
|
||||
|
@ -576,7 +576,7 @@ BOOL AtomPresentAndPointsToItself(Display *dpy, Atom atom, Atom type)
|
|||
|
||||
[self styleoffsets: &l : &r : &t : &b : style : win->ident];
|
||||
o = x;
|
||||
o.origin.y = [self boundsForScreen: win->screen].size.height - x.origin.y;
|
||||
o.origin.y = [self boundsForScreen: win->monitor_id].size.height - x.origin.y;
|
||||
o.origin.y = o.origin.y - x.size.height - b;
|
||||
o.origin.x -= l;
|
||||
o.size.width += l + r;
|
||||
|
@ -816,13 +816,13 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
onScreen = [[NSUserDefaults standardUserDefaults] boolForKey:
|
||||
@"GSBackChecksOffsetsOnScreen"];
|
||||
|
||||
root = [self _rootWindowForScreen: defScreen];
|
||||
context = [self xrContextForScreen: defScreen];
|
||||
root = [self _rootWindow];
|
||||
context = [self screenRContext];
|
||||
|
||||
window = NSAllocateCollectable(sizeof(gswindow_device_t), NSScannedOption);
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = defScreen;
|
||||
window->screen_id = defScreen;
|
||||
|
||||
window->win_attrs.flags |= GSWindowStyleAttr;
|
||||
window->win_attrs.window_style = style;
|
||||
|
@ -1239,14 +1239,14 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
return wmflags;
|
||||
}
|
||||
|
||||
- (gswindow_device_t *) _rootWindowForScreen: (int)screen
|
||||
- (gswindow_device_t *) _rootWindow
|
||||
{
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
gswindow_device_t *window;
|
||||
|
||||
/* Screen number is negative to avoid conflict with windows */
|
||||
window = WINDOW_WITH_TAG(-screen);
|
||||
window = WINDOW_WITH_TAG(-defScreen);
|
||||
if (window)
|
||||
return window;
|
||||
|
||||
|
@ -1254,14 +1254,15 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
|
||||
window->display = dpy;
|
||||
window->screen = screen;
|
||||
window->ident = RootWindow(dpy, screen);
|
||||
window->screen_id = defScreen;
|
||||
window->ident = RootWindow(dpy, defScreen);
|
||||
window->root = window->ident;
|
||||
window->type = NSBackingStoreNonretained;
|
||||
window->number = -screen;
|
||||
window->number = -defScreen;
|
||||
window->map_state = IsViewable;
|
||||
window->visibility = -1;
|
||||
window->wm_state = NormalState;
|
||||
window->monitor_id = 0;
|
||||
if (window->ident)
|
||||
{
|
||||
XGetGeometry(dpy, window->ident, &window->root,
|
||||
|
@ -1731,7 +1732,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
- (void) _createBuffer: (gswindow_device_t *)window
|
||||
{
|
||||
if (window->depth == 0)
|
||||
window->depth = DefaultDepth(dpy, window->screen);
|
||||
window->depth = DefaultDepth(dpy, window->screen_id);
|
||||
if (NSWidth(window->xframe) == 0 && NSHeight(window->xframe) == 0)
|
||||
{
|
||||
NSDebugLLog(@"NSWindow", @"Cannot create buffer for ZeroRect frame");
|
||||
|
@ -1893,15 +1894,16 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
_wmAppIcon = -1;
|
||||
return win;
|
||||
}
|
||||
root = [self _rootWindowForScreen: screen];
|
||||
context = [self xrContextForScreen: screen];
|
||||
root = [self _rootWindow];
|
||||
context = [self screenRContext];
|
||||
|
||||
/* Create the window structure and set the style early so we can use it to
|
||||
convert frames. */
|
||||
window = NSAllocateCollectable(sizeof(gswindow_device_t), NSScannedOption);
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = screen;
|
||||
window->screen_id = defScreen;
|
||||
window->monitor_id = screen;
|
||||
|
||||
window->win_attrs.flags |= GSWindowStyleAttr;
|
||||
if (handlesWindowDecorations)
|
||||
|
@ -2096,15 +2098,16 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
*screen = XScreenNumberOfScreen(win_attributes.screen);
|
||||
*type = NSBackingStoreNonretained;
|
||||
*style = NSBorderlessWindowMask;
|
||||
root = [self _rootWindowForScreen: *screen];
|
||||
context = [self xrContextForScreen: *screen];
|
||||
root = [self _rootWindow];
|
||||
context = [self screenRContext];
|
||||
|
||||
/* Create the window structure and set the style early so we can use it to
|
||||
convert frames. */
|
||||
window = NSAllocateCollectable(sizeof(gswindow_device_t), NSScannedOption);
|
||||
memset(window, '\0', sizeof(gswindow_device_t));
|
||||
window->display = dpy;
|
||||
window->screen = *screen;
|
||||
window->screen_id = defScreen;
|
||||
window->monitor_id = *screen;
|
||||
window->ident = windowRef;
|
||||
window->root = root->ident;
|
||||
window->parent = root->ident;
|
||||
|
@ -2406,7 +2409,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
xf.green = 65535 * [color greenComponent];
|
||||
xf.blue = 65535 * [color blueComponent];
|
||||
NSDebugLLog(@"XGTrace", @"setbackgroundcolor: %@ %d", color, win);
|
||||
xf = [self xColorFromColor: xf forScreen: window->screen];
|
||||
xf = [self xColorFromColor: xf];
|
||||
window->xwn_attrs.background_pixel = xf.pixel;
|
||||
XSetWindowBackground(dpy, window->ident, window->xwn_attrs.background_pixel);
|
||||
}
|
||||
|
@ -2588,9 +2591,9 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
under metacity, which sets _NET_WM_STATE for shaded windows to both
|
||||
_NET_WM_STATE_SHADED and _NET_WM_STATE_HIDDEN. */
|
||||
if (generic.flags.appOwnsMiniwindow && !(generic.wm & XGWM_WINDOWMAKER))
|
||||
XWithdrawWindow(dpy, window->ident, window->screen);
|
||||
XWithdrawWindow(dpy, window->ident, window->screen_id);
|
||||
else if (window->wm_state != IconicState)
|
||||
XIconifyWindow(dpy, window->ident, window->screen);
|
||||
XIconifyWindow(dpy, window->ident, window->screen_id);
|
||||
}
|
||||
|
||||
/* Actually this is "hide application" action.
|
||||
|
@ -2793,7 +2796,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
- (int) _createAppIconPixmaps
|
||||
{
|
||||
NSBitmapImageRep *rep;
|
||||
int width, height, colors, screen;
|
||||
int width, height, colors;
|
||||
RContext *rcontext;
|
||||
RXImage *rxImage;
|
||||
|
||||
|
@ -2805,8 +2808,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
if (rep == nil)
|
||||
return 0;
|
||||
|
||||
screen = [[[self screenList] objectAtIndex: 0] intValue];
|
||||
rcontext = [self xrContextForScreen: screen];
|
||||
rcontext = [self screenRContext];
|
||||
width = [rep pixelsWide];
|
||||
height = [rep pixelsHigh];
|
||||
colors = [rep samplesPerPixel];
|
||||
|
@ -2983,14 +2985,14 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
XWindowChanges chg;
|
||||
chg.sibling = other->ident;
|
||||
chg.stack_mode = Below;
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen,
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen_id,
|
||||
CWSibling|CWStackMode, &chg);
|
||||
}
|
||||
else
|
||||
{
|
||||
XWindowChanges chg;
|
||||
chg.stack_mode = Below;
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen,
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen_id,
|
||||
CWStackMode, &chg);
|
||||
}
|
||||
XMapWindow(dpy, window->ident);
|
||||
|
@ -3002,21 +3004,21 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
XWindowChanges chg;
|
||||
chg.sibling = other->ident;
|
||||
chg.stack_mode = Above;
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen,
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen_id,
|
||||
CWSibling|CWStackMode, &chg);
|
||||
}
|
||||
else
|
||||
{
|
||||
XWindowChanges chg;
|
||||
chg.stack_mode = Above;
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen,
|
||||
XReconfigureWMWindow(dpy, window->ident, window->screen_id,
|
||||
CWStackMode, &chg);
|
||||
}
|
||||
XMapWindow(dpy, window->ident);
|
||||
break;
|
||||
|
||||
case NSWindowOut:
|
||||
XWithdrawWindow (dpy, window->ident, window->screen);
|
||||
XWithdrawWindow (dpy, window->ident, window->screen_id);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
@ -3165,7 +3167,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
}
|
||||
|
||||
window->siz_hints.x = (int)loc.x;
|
||||
window->siz_hints.y = (int)([self boundsForScreen: window->screen].size.height -
|
||||
window->siz_hints.y = (int)([self boundsForScreen: window->monitor_id].size.height -
|
||||
loc.y - window->siz_hints.height);
|
||||
XMoveWindow (dpy, window->ident, window->siz_hints.x, window->siz_hints.y);
|
||||
setNormalHints(dpy, window);
|
||||
|
@ -3299,7 +3301,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
&x, &y, &width, &height, &window->border, &window->depth);
|
||||
window->xframe = NSMakeRect(x, y, width, height);
|
||||
|
||||
screenHeight = [self boundsForScreen: window->screen].size.height;
|
||||
screenHeight = [self boundsForScreen: window->monitor_id].size.height;
|
||||
rect = window->xframe;
|
||||
rect.origin.y = screenHeight - NSMaxY(window->xframe);
|
||||
return rect;
|
||||
|
@ -3497,7 +3499,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
NSMutableArray *ret;
|
||||
int c;
|
||||
|
||||
rootWindow = [self _rootWindowForScreen: defScreen];
|
||||
rootWindow = [self _rootWindow];
|
||||
|
||||
windowOrder = (Window *)PropGetCheckProperty(dpy, rootWindow->ident,
|
||||
generic._NET_CLIENT_LIST_STACKING_ATOM,
|
||||
|
@ -3810,7 +3812,7 @@ swapColors(unsigned char *image_data, int width, int height,
|
|||
destY = height - mouseLocation.y;
|
||||
destX = mouseLocation.x;
|
||||
|
||||
XWarpPointer(dpy, None, [self xDisplayRootWindowForScreen: aScreen],
|
||||
XWarpPointer(dpy, None, [self xDisplayRootWindow],
|
||||
0, 0, 0, 0, destX, destY);
|
||||
}
|
||||
|
||||
|
@ -4005,7 +4007,7 @@ static BOOL cursor_hidden = NO;
|
|||
{
|
||||
Pixmap shape, mask;
|
||||
XColor black, white;
|
||||
Drawable drw = [self xDisplayRootWindowForScreen: defScreen];
|
||||
Drawable drw = [self xDisplayRootWindow];
|
||||
|
||||
shape = XCreatePixmapFromBitmapData(dpy, drw,
|
||||
xgps_blank_cursor_bits,
|
||||
|
@ -4014,9 +4016,9 @@ static BOOL cursor_hidden = NO;
|
|||
xgps_blank_cursor_bits,
|
||||
16, 16, 1, 0, 1);
|
||||
black.red = black.green = black.blue = 0;
|
||||
black = [self xColorFromColor: black forScreen: defScreen];
|
||||
black = [self xColorFromColor: black];
|
||||
white.red = white.green = white.blue = 65535;
|
||||
white = [self xColorFromColor: white forScreen: defScreen];
|
||||
white = [self xColorFromColor: white];
|
||||
|
||||
xgps_blank_cursor = XCreatePixmapCursor(dpy, shape, mask,
|
||||
&white, &black, 0, 0);
|
||||
|
@ -4299,8 +4301,8 @@ xgps_cursor_image(Display *xdpy, Drawable draw, const unsigned char *data,
|
|||
|
||||
source = xgps_cursor_image(dpy, ROOT, data, w, h, colors, &fg, &bg);
|
||||
mask = alphaMaskForImage(dpy, ROOT, data, w, h, colors, ALPHA_THRESHOLD);
|
||||
bg = [self xColorFromColor: bg forScreen: defScreen];
|
||||
fg = [self xColorFromColor: fg forScreen: defScreen];
|
||||
bg = [self xColorFromColor: bg];
|
||||
fg = [self xColorFromColor: fg];
|
||||
|
||||
cursor = XCreatePixmapCursor(dpy, source, mask, &fg, &bg,
|
||||
(int)hotp.x, (int)hotp.y);
|
||||
|
@ -4338,8 +4340,8 @@ xgps_cursor_image(Display *xdpy, Drawable draw, const unsigned char *data,
|
|||
xb.red = 65535 * [bg redComponent];
|
||||
xb.green = 65535 * [bg greenComponent];
|
||||
xb.blue = 65535 * [bg blueComponent];
|
||||
xf = [self xColorFromColor: xf forScreen: defScreen];
|
||||
xb = [self xColorFromColor: xb forScreen: defScreen];
|
||||
xf = [self xColorFromColor: xf];
|
||||
xb = [self xColorFromColor: xb];
|
||||
|
||||
XRecolorCursor(dpy, cursor, &xf, &xb);
|
||||
}
|
||||
|
@ -4416,14 +4418,16 @@ _computeDepth(int class, int bpp)
|
|||
/* This method assumes that we deal with one X11 screen - `defScreen`.
|
||||
Basically it means that we have DISPLAY variable set to `:0.0`.
|
||||
AppKit and X11 use the same term "screen" with different meaning:
|
||||
AppKit Screen - single mintor/display device.
|
||||
X11 Screen - its a plane where X Server can draw on.
|
||||
XRandR - Xorg extension that halps to manipulate monitors layout providing
|
||||
X11 Screen. */
|
||||
AppKit Screen - single monitor/display device.
|
||||
X11 Screen - it's a plane where X Server can draw on.
|
||||
XRandR - Xorg extension that helps to manipulate monitor layout providing
|
||||
X11 Screen.
|
||||
We map XRandR monitors (outputs) to NSScreen. */
|
||||
- (NSArray *)screenList
|
||||
{
|
||||
NSMutableArray *screens;
|
||||
int i;
|
||||
NSArray *screens;
|
||||
NSMutableArray *tmpScreens;
|
||||
int i;
|
||||
|
||||
monitorsCount = 0;
|
||||
if (monitors != NULL) {
|
||||
|
@ -4436,53 +4440,55 @@ _computeDepth(int class, int bpp)
|
|||
XRRCrtcInfo *crtc_info;
|
||||
|
||||
screen_res = XRRGetScreenResources(dpy, RootWindow(dpy, defScreen));
|
||||
monitorsCount = screen_res->noutput;
|
||||
|
||||
if (monitorsCount > 0)
|
||||
if (screen_res != NULL)
|
||||
{
|
||||
screens = [NSMutableArray arrayWithCapacity: monitorsCount];
|
||||
monitorsCount = screen_res->noutput;
|
||||
tmpScreens = [NSMutableArray arrayWithCapacity: monitorsCount];
|
||||
monitors = NSZoneMalloc([self zone], monitorsCount * sizeof(MonitorDevice));
|
||||
|
||||
for (i = 0; i < monitorsCount; i++)
|
||||
{
|
||||
output_info = XRRGetOutputInfo(dpy, screen_res, screen_res->outputs[i]);
|
||||
monitors[i].screen_id = defScreen;
|
||||
if (output_info->crtc)
|
||||
{
|
||||
crtc_info = XRRGetCrtcInfo(dpy, screen_res, output_info->crtc);
|
||||
|
||||
// Fill the cache of device parameters
|
||||
monitors[i].depth = [self windowDepthForScreen: i];
|
||||
monitors[i].resolution = [self resolutionForScreen: i];
|
||||
monitors[i].depth = [self windowDepthForScreen: defScreen];
|
||||
monitors[i].resolution = [self resolutionForScreen: defScreen];
|
||||
monitors[i].frame = NSMakeRect(crtc_info->x, crtc_info->y,
|
||||
crtc_info->width, crtc_info->height);
|
||||
// Add number of device
|
||||
[screens addObject: [NSNumber numberWithInt: i]];
|
||||
[tmpScreens addObject: [NSNumber numberWithInt: i]];
|
||||
}
|
||||
}
|
||||
XRRFreeScreenResources(screen_res);
|
||||
screens = [NSArray arrayWithArray: tmpScreens];
|
||||
}
|
||||
XRRFreeScreenResources(screen_res);
|
||||
#endif
|
||||
|
||||
if (monitorsCount == 0)
|
||||
{
|
||||
monitorsCount = ScreenCount(dpy);
|
||||
monitors = NSZoneMalloc([self zone], monitorsCount * sizeof(MonitorDevice));
|
||||
screens = [NSMutableArray arrayWithCapacity: monitorsCount];
|
||||
for (i = 0; i < monitorsCount; i++)
|
||||
{
|
||||
monitors[i].depth = [self windowDepthForScreen: i];
|
||||
monitors[i].resolution = [self resolutionForScreen: i];
|
||||
monitors[i].frame = NSMakeRect(0, 0,
|
||||
DisplayWidth(dpy, i),
|
||||
DisplayHeight(dpy, i));
|
||||
[screens addObject: [NSNumber numberWithInt: i]];
|
||||
}
|
||||
/* Assumed that it's always available 1 screen per application. We only
|
||||
need to know it's number and it was saved in _initXContext as
|
||||
`defScreen`. */
|
||||
monitorsCount = 1;
|
||||
monitors = NSZoneMalloc([self zone], sizeof(MonitorDevice));
|
||||
monitors[0].screen_id = defScreen;
|
||||
monitors[0].depth = [self windowDepthForScreen: defScreen];
|
||||
monitors[0].resolution = [self resolutionForScreen: defScreen];
|
||||
monitors[0].frame = NSMakeRect(0, 0,
|
||||
DisplayWidth(dpy, defScreen),
|
||||
DisplayHeight(dpy, defScreen));
|
||||
screens = [NSArray arrayWithObject: [NSNumber numberWithInt: defScreen]];
|
||||
}
|
||||
|
||||
return screens;
|
||||
}
|
||||
|
||||
- (NSWindowDepth) windowDepthForScreen: (int) screen
|
||||
// `screen` is a Xlib screen number.
|
||||
- (NSWindowDepth) windowDepthForScreen: (int)screen
|
||||
{
|
||||
Screen *x_screen;
|
||||
int class = 0, bpp = 0;
|
||||
|
@ -4492,12 +4498,7 @@ _computeDepth(int class, int bpp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_RANDR
|
||||
// `screen_num` is a monitor index not X11 screen
|
||||
x_screen = XScreenOfDisplay(dpy, defScreen);
|
||||
#else
|
||||
x_screen = XScreenOfDisplay(dpy, screen);
|
||||
#endif
|
||||
|
||||
if (x_screen == NULL)
|
||||
{
|
||||
|
@ -4510,7 +4511,8 @@ _computeDepth(int class, int bpp)
|
|||
return _computeDepth(class, bpp);
|
||||
}
|
||||
|
||||
- (const NSWindowDepth *) availableDepthsForScreen: (int) screen
|
||||
// `screen` is a monitor index not X11 screen
|
||||
- (const NSWindowDepth *) availableDepthsForScreen: (int)screen
|
||||
{
|
||||
Screen *x_screen;
|
||||
int class = 0;
|
||||
|
@ -4524,12 +4526,7 @@ _computeDepth(int class, int bpp)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_RANDR
|
||||
// `screen_num` is a monitor index not X11 screen
|
||||
x_screen = XScreenOfDisplay(dpy, defScreen);
|
||||
#else
|
||||
x_screen = XScreenOfDisplay(dpy, screen);
|
||||
#endif
|
||||
x_screen = XScreenOfDisplay(dpy, monitors[screen].screen_id);
|
||||
|
||||
if (x_screen == NULL)
|
||||
{
|
||||
|
@ -4550,6 +4547,7 @@ _computeDepth(int class, int bpp)
|
|||
return depths;
|
||||
}
|
||||
|
||||
// `screen` is a Xlib screen number.
|
||||
- (NSSize) resolutionForScreen: (int)screen
|
||||
{
|
||||
// NOTE:
|
||||
|
@ -4583,6 +4581,7 @@ _computeDepth(int class, int bpp)
|
|||
*/
|
||||
}
|
||||
|
||||
// `screen` is a monitor index not X11 screen
|
||||
- (NSRect) boundsForScreen: (int)screen
|
||||
{
|
||||
NSRect boundsRect = NSZeroRect;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
- (id) initWithDelegate: (id)aDelegate
|
||||
name: (NSString *)name
|
||||
{
|
||||
Display *dpy = [XGServer currentXDisplay];
|
||||
Display *dpy = [XGServer xDisplay];
|
||||
return [self initWithDelegate: aDelegate display: dpy name: name];
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ betterStyle(XIMStyle a, XIMStyle b, XIMStyle xim_requested_style)
|
|||
}
|
||||
else if (xim_style == OffTheSpotStyle || xim_style == OverTheSpotStyle)
|
||||
{
|
||||
Display *dpy = [XGServer currentXDisplay];
|
||||
Display *dpy = [XGServer xDisplay];
|
||||
XFontSet font_set;
|
||||
char **missing_charset;
|
||||
int num_missing_charset;
|
||||
|
@ -556,7 +556,7 @@ finish:
|
|||
|
||||
if (XGetICValues(xics[num_xics - 1], XNClientWindow, &win, NULL))
|
||||
return NO;
|
||||
dpy = [XGServer currentXDisplay];
|
||||
dpy = [XGServer xDisplay];
|
||||
if (XTranslateCoordinates(dpy, win, DefaultRootWindow(dpy), 0, 0,
|
||||
&abs_x, &abs_y, &dummy) == 0)
|
||||
return NO;
|
||||
|
|
|
@ -222,8 +222,8 @@ no_xshm:
|
|||
visual = DefaultVisual(wi->display, DefaultScreen(wi->display));
|
||||
#else
|
||||
// Better to get the used visual from the XGServer.
|
||||
visual = [(XGServer*)GSCurrentServer() visualForScreen: awindow->screen];
|
||||
drawing_depth = [(XGServer*)GSCurrentServer() depthForScreen: awindow->screen];
|
||||
visual = [(XGServer*)GSCurrentServer() screenVisual];
|
||||
drawing_depth = [(XGServer*)GSCurrentServer() screenDepth];
|
||||
#endif
|
||||
|
||||
/* TODO: resolve properly.
|
||||
|
|
Loading…
Reference in a new issue