* Source/x11/XGServerWindow.m (_OSFrameToXFrame:for:):,

(_OSFrameToXHints:for:): use Xlib screen height instead of monitor's
  because we convert coordinates to Xlib area.

* Source/x11/XGServerEvent.m (processEvent:): update monitor_id from
  NSWindow's screen number (it could change after event processing).
  (mouseLocationOnScreen🪟): use Xlib screen height instead of
  monitor's. Added comment to code that should be probably removed
  later.
This commit is contained in:
Sergii Stoian 2020-02-07 16:01:03 +02:00
parent 84ec2f0110
commit 82931a4a61
3 changed files with 30 additions and 5 deletions

View file

@ -1,3 +1,15 @@
2020-02-07 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XGServerWindow.m (_OSFrameToXFrame:for:):,
(_OSFrameToXHints:for:): use Xlib screen height instead of monitor's
because we convert coordinates to Xlib area.
* Source/x11/XGServerEvent.m (processEvent:): update monitor_id from
NSWindow's screen number (it could change after event processing).
(mouseLocationOnScreen:window:): use Xlib screen height instead of
monitor's. Added comment to code that should be probably removed
later.
2020-02-03 Sergii Stoian <stoyan255@gmail.com>
* Source/x11/XWindowBuffer.m (windowBufferForWindow:depthInfo:): use

View file

@ -1029,6 +1029,7 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
if (!NSEqualPoints(r.origin, x.origin))
{
NSEvent *r;
NSWindow *window;
r = [NSEvent otherEventWithType: NSAppKitDefined
location: eventLocation
@ -1045,7 +1046,12 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
* the programa can move/resize the window while we send
* this event, causing a confusion.
*/
[[NSApp windowWithWindowNumber: cWin->number] sendEvent: r];
window = [NSApp windowWithWindowNumber: cWin->number];
[window sendEvent: r];
/* Update monitor_id of the backend window.
NSWindow may change screen pointer while processing
the event. */
cWin->monitor_id = [[window screen] screenNumber];
}
}
break;
@ -2671,8 +2677,13 @@ process_modifier_flags(unsigned int state)
int screen_id;
ok = XQueryPointer (dpy, [self xDisplayRootWindow],
&rootWin, &childWin, &currentX, &currentY, &winX, &winY, &mask);
&rootWin, &childWin, &currentX, &currentY,
&winX, &winY, &mask);
p = NSMakePoint(-1,-1);
/* FIXME: After multi-monitor support will be implemented `screen` method
parameter doesn't make sense. The `if{}` block should be removed since
we have only one screen and mouse can't be placed on "wrong" screen.
Also actually we need `height` of the whole Xlib screen (defScreen). */
if (ok == False)
{
/* Mouse not on the specified screen_number */
@ -2691,7 +2702,9 @@ process_modifier_flags(unsigned int state)
height = attribs.height;
}
else
height = [self boundsForScreen: screen].size.height;
{
height = DisplayHeight(dpy, defScreen);
}
p = NSMakePoint(currentX, height - currentY);
if (win)
{

View file

@ -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->monitor_id].size.height - x.origin.y;
x.origin.y = DisplayHeight(dpy, defScreen) - 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->monitor_id].size.height - x.origin.y;
x.origin.y = DisplayHeight(dpy, defScreen) - x.origin.y;
NSDebugLLog(@"Frame", @"O2H %lu, %x, %@, %@", win->number, style,
NSStringFromRect(o), NSStringFromRect(x));
return x;