mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
* Headers/x11/XGServer.h (GSDisplayServer): RandR event and error base
ivars were added. * Source/x11/XGServer.m (_initXContext): get RandR event and error base. * Source/x11/XGServerEvent.m (processEvent:): pack several RandR events into one notification post.
This commit is contained in:
parent
501c6eb018
commit
64335397b5
4 changed files with 12 additions and 5 deletions
|
@ -1,11 +1,12 @@
|
|||
2020-01-23 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
||||
* Headers/x11/XGServer.h (GSDisplayServer): RandR event and error base
|
||||
ivars were added.
|
||||
* Source/x11/XGServer.m (_initXContext): get RandR event and error base.
|
||||
* Source/x11/XGServerWindow.m (boundsForScreen:): if Xrandr support
|
||||
enabled get screen dimensions using Xrandr objects.
|
||||
|
||||
* Source/x11/XGServerEvent.m (processEvent:): process Xrandr event and
|
||||
send NSApplicationDidChangeScreenParametersNotification.
|
||||
|
||||
* Source/x11/XGServer.m (_initXContext): subscribe to the Xrandr event.
|
||||
|
||||
2020-01-22 Sergii Stoian <stoyan255@gmail.com>
|
||||
|
|
|
@ -60,6 +60,7 @@ typedef enum {
|
|||
Window grabWindow;
|
||||
struct XGGeneric generic;
|
||||
id inputServer;
|
||||
int randrEventBase, randrErrorBase;
|
||||
}
|
||||
|
||||
+ (Display*) currentXDisplay;
|
||||
|
|
|
@ -475,6 +475,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
|
|||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
XRRQueryExtension(dpy, &randrEventBase, &randrErrorBase);
|
||||
XRRSelectInput(dpy, RootWindow(dpy, i), RRScreenChangeNotifyMask);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1899,16 +1899,20 @@ posixFileDescriptor: (NSPosixFileDescriptor*)fileDescriptor
|
|||
}
|
||||
#endif
|
||||
#ifdef HAVE_XRANDR
|
||||
if (xEvent.type & RRScreenChangeNotifyMask)
|
||||
int randr_event_type = randrEventBase + RRScreenChangeNotify;
|
||||
if (xEvent.type == randr_event_type)
|
||||
{
|
||||
int count = ScreenCount(dpy);
|
||||
int i;
|
||||
int count = ScreenCount(dpy), i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (xEvent.xconfigure.window == RootWindow(dpy, i))
|
||||
{
|
||||
NSLog(@"[XGServerEvent] RRScreenChangeNotify for screen %i/%i",
|
||||
i, count);
|
||||
// Check if other RandR events are waiting in the queue.
|
||||
XSync(dpy,0);
|
||||
while (XCheckTypedEvent(dpy, randr_event_type, &xEvent)) {;}
|
||||
|
||||
XRRUpdateConfiguration(event);
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidChangeScreenParametersNotification
|
||||
|
|
Loading…
Reference in a new issue