Пример #1
0
void psb_xrandr_thread(void* arg)
{
    VADriverContextP ctx = (VADriverContextP)arg;
    INIT_DRIVER_DATA;
    int event_base, error_base;
    XEvent event;
    XRRQueryExtension(psb_xrandr_info->dpy, &event_base, &error_base);
    XRRSelectInput(psb_xrandr_info->dpy, psb_xrandr_info->root, RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask);
    drv_debug_msg(VIDEO_DEBUG_GENERAL, "Xrandr: psb xrandr thread start\n");

    while (1) {
        if (XCheckIfEvent(psb_xrandr_info->dpy, (XEvent *)&event, outputChangePredicate, NULL)) {
            if (event.type == ClientMessage) {
                drv_debug_msg(VIDEO_DEBUG_GENERAL, "Xrandr: receive ClientMessage event, thread should exit\n");
                XClientMessageEvent *evt;
                evt = (XClientMessageEvent*) & event;
                if (evt->message_type == psb_xrandr_info->psb_exit_atom) {
                    drv_debug_msg(VIDEO_DEBUG_GENERAL, "Xrandr: xrandr thread exit safely\n");
                    pthread_exit(NULL);
                }
            }
            switch (event.type - event_base) {
            case RRNotify_OutputChange:
                XRRUpdateConfiguration(&event);
                drv_debug_msg(VIDEO_DEBUG_GENERAL, "Xrandr: receive RRNotify_OutputChange event, refresh output/crtc info\n");
                driver_data->xrandr_update = 1;
                psb_xrandr_refresh(ctx);
                break;
            default:
                break;
            }
        }
        usleep(200000);
    }
}
Пример #2
0
void eventNotifier::do_RRNotify (XEvent *eventp)
{
    XRRNotifyEvent *e = (XRRNotifyEvent *) eventp;
    XRRScreenResources *screen_resources;

    XRRUpdateConfiguration (eventp);
    screen_resources = XRRGetScreenResources (m_pDpy, m_screen);
    prologue (eventp, "RRNotify");
    switch (e->subtype) {
      case RRNotify_OutputChange:
        qDebug() << "OutputChange";
//          do_RRNotify_OutputChange (eventp, screen_resources); break;
      break;

      case RRNotify_CrtcChange:
        qDebug() << "CrtcChange";
//         do_RRNotify_CrtcChange (eventp, screen_resources); break;
      break;

      case RRNotify_OutputProperty:
        qDebug() << "OutputProperty";
//          do_RRNotify_OutputProperty (eventp, screen_resources); break;
      break;

      default:
          printf ("    subtype %d\n", e->subtype);
    }
    XRRFreeScreenResources (screen_resources);
}
Пример #3
0
/*
 * Class:     jogamp_newt_driver_x11_RandR13
 * Method:    sendRRScreenChangeNotify0
 * Signature: (JJ)V
 */
JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_RandR13_sendRRScreenChangeNotify0
  (JNIEnv *env, jclass clazz, jlong display, jlong jevent)
{
    Display * dpy = (Display *) (intptr_t) display;
    XEvent *event = (XEvent*)(intptr_t)jevent;
    XRRUpdateConfiguration(event);
    DBG_PRINT("RandR13_sendRRScreenChangeNotify0: dpy %p, event %p\n", dpy, event);
}
Пример #4
0
Файл: event.c Проект: n4cht/kwm
/** Event handle function: execute every function
 * handle by event
 * \param ev Event
 */
void
getevent(XEvent ev)
{

     switch(ev.type)
     {
     case ButtonPress:      buttonpress(&ev.xbutton);                 break;
     case ClientMessage:    clientmessageevent(&ev.xclient);          break;
     case ConfigureRequest: configureevent(&ev.xconfigurerequest);    break;
     case DestroyNotify:    destroynotify(&ev.xdestroywindow);        break;
     case EnterNotify:      enternotify(&ev.xcrossing);               break;
     case Expose:           expose(&ev.xexpose);                      break;
     case FocusIn:          focusin(&ev.xfocus);                      break;
     case KeyPress:         keypress(&ev.xkey);                       break;
     case MapNotify:        mapnotify(&ev.xmap);                      break;
     case MapRequest:       maprequest(&ev.xmaprequest);              break;
     case MappingNotify:    mappingnotify(&ev.xmapping);              break;
     case MotionNotify:     motionnotify(&ev.xmotion);                break;
     case PropertyNotify:   propertynotify(&ev.xproperty);            break;
     case ReparentNotify:   reparentnotify(&ev.xreparent);            break;
     case SelectionClear:   selectionclearevent(&ev.xselectionclear); break;
     case UnmapNotify:      unmapnotify(&ev.xunmap);                  break;
     default:

#ifdef HAVE_XRANDR
          /* Check Xrandr event */
          if(ev.type == xrandr_event)
          {
               /* Update xrandr configuration */
               XRRUpdateConfiguration(&ev);

               /* Reload WMFS to update the screen(s) geometry changement */
               quit();
               for(; argv_global[0] && argv_global[0] == ' '; ++argv_global);
               execvp(argv_global, all_argv);
          }
#endif /* HAVE_XRANDR */
          break;
     }

     return;
}
Пример #5
0
void
_gdk_x11_screen_size_changed (GdkX11Screen *screen,
			      const XEvent *event)
{
#ifdef HAVE_RANDR
  GdkX11Display *display_x11;

  display_x11 = GDK_X11_DISPLAY (GDK_SCREEN_DISPLAY (screen));

  if (display_x11->have_randr13 && event->type == ConfigureNotify)
    return;

  XRRUpdateConfiguration ((XEvent *) event);
#else
  if (event->type != ConfigureNotify)
    return;
#endif

  process_monitors_change (screen);
}
Пример #6
0
void
_gdk_x11_screen_size_changed (GdkScreen *screen,
			      XEvent    *event)
{
  gint width, height;
#ifdef HAVE_RANDR
  GdkX11Display *display_x11;
#endif

  width = gdk_screen_get_width (screen);
  height = gdk_screen_get_height (screen);

#ifdef HAVE_RANDR
  display_x11 = GDK_X11_DISPLAY (gdk_screen_get_display (screen));

  if (display_x11->have_randr13 && event->type == ConfigureNotify)
    return;

  XRRUpdateConfiguration (event);
#else
  if (event->type == ConfigureNotify)
    {
      XConfigureEvent *rcevent = (XConfigureEvent *) event;
      Screen	    *xscreen = gdk_x11_screen_get_xscreen (screen);

      xscreen->width   = rcevent->width;
      xscreen->height  = rcevent->height;
    }
  else
    return;
#endif

  process_monitors_change (screen);

  if (width != gdk_screen_get_width (screen) ||
      height != gdk_screen_get_height (screen))
    g_signal_emit_by_name (screen, "size-changed");
}
JNIEXPORT jint JNICALL Java_org_lwjgl_system_linux_Xrandr_nXRRUpdateConfiguration(JNIEnv *__env, jclass clazz, jlong eventAddress) {
	XEvent *event = (XEvent *)(intptr_t)eventAddress;
	UNUSED_PARAMS(__env, clazz)
	return (jint)XRRUpdateConfiguration(event);
}
Пример #8
0
static void processEvent(XEvent *event)
{
    _GLFWwindow* window;

    switch (event->type)
    {
	case KeyPress:
	{
	    // A keyboard key was pressed
	    window = findWindow(event->xkey.window);
	    if (window == NULL)
		return;

	    _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_PRESS);
	    _glfwInputChar(window, translateChar(&event->xkey));
	    break;
	}

	case KeyRelease:
	{
	    // A keyboard key was released
	    window = findWindow(event->xkey.window);
	    if (window == NULL)
		return;

	    // Do not report key releases for key repeats. For key repeats we
	    // will get KeyRelease/KeyPress pairs with similar or identical
	    // time stamps. User selected key repeat filtering is handled in
	    // _glfwInputKey/_glfwInputChar.
	    if (XEventsQueued(_glfwLibrary.X11.display, QueuedAfterReading))
	    {
		XEvent nextEvent;
		XPeekEvent(_glfwLibrary.X11.display, &nextEvent);

		if (nextEvent.type == KeyPress &&
		    nextEvent.xkey.window == event->xkey.window &&
		    nextEvent.xkey.keycode == event->xkey.keycode)
		{
		    // This last check is a hack to work around key repeats
		    // leaking through due to some sort of time drift
		    // Toshiyuki Takahashi can press a button 16 times per
		    // second so it's fairly safe to assume that no human is
		    // pressing the key 50 times per second (value is ms)
		    if ((nextEvent.xkey.time - event->xkey.time) < 20)
		    {
			// Do not report anything for this event
			break;
		    }
		}
	    }

	    _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_RELEASE);
	    break;
	}

	case ButtonPress:
	{
	    // A mouse button was pressed or a scrolling event occurred
	    window = findWindow(event->xbutton.window);
	    if (window == NULL)
		return;

	    if (event->xbutton.button == Button1)
		_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS);
	    else if (event->xbutton.button == Button2)
		_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS);
	    else if (event->xbutton.button == Button3)
		_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS);

	    // XFree86 3.3.2 and later translates mouse wheel up/down into
	    // mouse button 4 & 5 presses
	    else if (event->xbutton.button == Button4)
		_glfwInputScroll(window, 0.0, 1.0);
	    else if (event->xbutton.button == Button5)
		_glfwInputScroll(window, 0.0, -1.0);

	    else if (event->xbutton.button == Button6)
		_glfwInputScroll(window, -1.0, 0.0);
	    else if (event->xbutton.button == Button7)
		_glfwInputScroll(window, 1.0, 0.0);

	    break;
	}

	case ButtonRelease:
	{
	    // A mouse button was released
	    window = findWindow(event->xbutton.window);
	    if (window == NULL)
		return;

	    if (event->xbutton.button == Button1)
	    {
		_glfwInputMouseClick(window,
				     GLFW_MOUSE_BUTTON_LEFT,
				     GLFW_RELEASE);
	    }
	    else if (event->xbutton.button == Button2)
	    {
		_glfwInputMouseClick(window,
				     GLFW_MOUSE_BUTTON_MIDDLE,
				     GLFW_RELEASE);
	    }
	    else if (event->xbutton.button == Button3)
	    {
		_glfwInputMouseClick(window,
				     GLFW_MOUSE_BUTTON_RIGHT,
				     GLFW_RELEASE);
	    }
	    break;
	}

	case EnterNotify:
	{
	    // The cursor entered the window
	    window = findWindow(event->xcrossing.window);
	    if (window == NULL)
		return;

	    if (window->cursorMode == GLFW_CURSOR_HIDDEN)
		hideCursor(window);

	    _glfwInputCursorEnter(window, GL_TRUE);
	    break;
	}

	case LeaveNotify:
	{
	    // The cursor left the window
	    window = findWindow(event->xcrossing.window);
	    if (window == NULL)
		return;

	    if (window->cursorMode == GLFW_CURSOR_HIDDEN)
		showCursor(window);

	    _glfwInputCursorEnter(window, GL_FALSE);
	    break;
	}

	case MotionNotify:
	{
	    // The cursor was moved
	    window = findWindow(event->xmotion.window);
	    if (window == NULL)
		return;

	    if (event->xmotion.x != window->X11.cursorPosX ||
		event->xmotion.y != window->X11.cursorPosY)
	    {
		// The cursor was moved by something other than GLFW

		int x, y;

		if (window->cursorMode == GLFW_CURSOR_CAPTURED)
		{
		    if (_glfwLibrary.activeWindow != window)
			break;

		    x = event->xmotion.x - window->X11.cursorPosX;
		    y = event->xmotion.y - window->X11.cursorPosY;
		}
		else
		{
		    x = event->xmotion.x;
		    y = event->xmotion.y;
		}

		window->X11.cursorPosX = event->xmotion.x;
		window->X11.cursorPosY = event->xmotion.y;
		window->X11.cursorCentered = GL_FALSE;

		_glfwInputCursorMotion(window, x, y);
	    }

	    break;
	}

	case ConfigureNotify:
	{
	    // The window configuration changed somehow
	    window = findWindow(event->xconfigure.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowSize(window,
				 event->xconfigure.width,
				 event->xconfigure.height);

	    _glfwInputWindowPos(window,
				event->xconfigure.x,
				event->xconfigure.y);

	    break;
	}

	case ClientMessage:
	{
	    // Custom client message, probably from the window manager
	    window = findWindow(event->xclient.window);
	    if (window == NULL)
		return;

	    if ((Atom) event->xclient.data.l[0] == _glfwLibrary.X11.wmDeleteWindow)
	    {
		// The window manager was asked to close the window, for example by
		// the user pressing a 'close' window decoration button

		_glfwInputWindowCloseRequest(window);
	    }
	    else if (_glfwLibrary.X11.wmPing != None &&
		     (Atom) event->xclient.data.l[0] == _glfwLibrary.X11.wmPing)
	    {
		// The window manager is pinging the application to ensure it's
		// still responding to events

		event->xclient.window = _glfwLibrary.X11.root;
		XSendEvent(_glfwLibrary.X11.display,
			   event->xclient.window,
			   False,
			   SubstructureNotifyMask | SubstructureRedirectMask,
			   event);
	    }

	    break;
	}

	case MapNotify:
	{
	    // The window was mapped
	    window = findWindow(event->xmap.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowVisibility(window, GL_TRUE);
	    _glfwInputWindowIconify(window, GL_FALSE);
	    break;
	}

	case UnmapNotify:
	{
	    // The window was unmapped
	    window = findWindow(event->xmap.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowVisibility(window, GL_FALSE);
	    _glfwInputWindowIconify(window, GL_TRUE);
	    break;
	}

	case FocusIn:
	{
	    // The window gained focus
	    window = findWindow(event->xfocus.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowFocus(window, GL_TRUE);

	    if (window->cursorMode == GLFW_CURSOR_CAPTURED)
		captureCursor(window);

	    break;
	}

	case FocusOut:
	{
	    // The window lost focus
	    window = findWindow(event->xfocus.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowFocus(window, GL_FALSE);

	    if (window->cursorMode == GLFW_CURSOR_CAPTURED)
		showCursor(window);

	    break;
	}

	case Expose:
	{
	    // The window's contents was damaged
	    window = findWindow(event->xexpose.window);
	    if (window == NULL)
		return;

	    _glfwInputWindowDamage(window);
	    break;
	}

	case SelectionClear:
	{
	    // The ownership of the selection was lost

	    free(_glfwLibrary.X11.selection.string);
	    _glfwLibrary.X11.selection.string = NULL;
	    break;
	}

	case SelectionNotify:
	{
	    // The selection conversion status is available

	    XSelectionEvent* request = &event->xselection;

	    if (_glfwReadSelection(request))
		_glfwLibrary.X11.selection.status = _GLFW_CONVERSION_SUCCEEDED;
	    else
		_glfwLibrary.X11.selection.status = _GLFW_CONVERSION_FAILED;

	    break;
	}

	case SelectionRequest:
	{
	    // The contents of the selection was requested

	    XSelectionRequestEvent* request = &event->xselectionrequest;

	    XEvent response;
	    memset(&response, 0, sizeof(response));

	    response.xselection.property = _glfwWriteSelection(request);
	    response.xselection.type = SelectionNotify;
	    response.xselection.display = request->display;
	    response.xselection.requestor = request->requestor;
	    response.xselection.selection = request->selection;
	    response.xselection.target = request->target;
	    response.xselection.time = request->time;

	    XSendEvent(_glfwLibrary.X11.display,
		       request->requestor,
		       False, 0, &response);
	    break;
	}

	case DestroyNotify:
	    return;

	default:
	{
#if defined(_GLFW_HAS_XRANDR)
	    switch (event->type - _glfwLibrary.X11.RandR.eventBase)
	    {
		case RRScreenChangeNotify:
		{
		    XRRUpdateConfiguration(event);
		    break;
		}
	    }
#endif /*_GLFW_HAS_XRANDR*/
	    break;
	}
    }
}
Пример #9
0
// Process the specified X event
//
static void processEvent(XEvent *event)
{
    _GLFWwindow* window = NULL;

    if (event->type != GenericEvent)
    {
        window = _glfwFindWindowByHandle(event->xany.window);
        if (window == NULL)
        {
            // This is either an event for a destroyed GLFW window or an event
            // of a type not currently supported by GLFW
            return;
        }
    }

    switch (event->type)
    {
        case KeyPress:
        {
            _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_PRESS);

            if (!(event->xkey.state & ControlMask) &&
                !(event->xkey.state & Mod1Mask /*Alt*/))
            {
            _glfwInputChar(window, translateChar(&event->xkey));
            }

            break;
        }

        case KeyRelease:
        {
            _glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_RELEASE);
            break;
        }

        case ButtonPress:
        {
            if (event->xbutton.button == Button1)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS);
            else if (event->xbutton.button == Button2)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS);
            else if (event->xbutton.button == Button3)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS);

            // Modern X provides scroll events as mouse button presses
            else if (event->xbutton.button == Button4)
                _glfwInputScroll(window, 0.0, 1.0);
            else if (event->xbutton.button == Button5)
                _glfwInputScroll(window, 0.0, -1.0);
            else if (event->xbutton.button == Button6)
                _glfwInputScroll(window, -1.0, 0.0);
            else if (event->xbutton.button == Button7)
                _glfwInputScroll(window, 1.0, 0.0);

            break;
        }

        case ButtonRelease:
        {
            if (event->xbutton.button == Button1)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_LEFT,
                                     GLFW_RELEASE);
            }
            else if (event->xbutton.button == Button2)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_MIDDLE,
                                     GLFW_RELEASE);
            }
            else if (event->xbutton.button == Button3)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_RIGHT,
                                     GLFW_RELEASE);
            }
            break;
        }

        case EnterNotify:
        {
            if (window->cursorMode == GLFW_CURSOR_HIDDEN)
                hideCursor(window);

            _glfwInputCursorEnter(window, GL_TRUE);
            break;
        }

        case LeaveNotify:
        {
            if (window->cursorMode == GLFW_CURSOR_HIDDEN)
                showCursor(window);

            _glfwInputCursorEnter(window, GL_FALSE);
            break;
        }

        case MotionNotify:
        {
            if (event->xmotion.x != window->x11.cursorPosX ||
                event->xmotion.y != window->x11.cursorPosY)
            {
                // The cursor was moved by something other than GLFW

                int x, y;

                if (window->cursorMode == GLFW_CURSOR_CAPTURED)
                {
                    if (_glfw.focusedWindow != window)
                        break;

                    x = event->xmotion.x - window->x11.cursorPosX;
                    y = event->xmotion.y - window->x11.cursorPosY;
                }
                else
                {
                    x = event->xmotion.x;
                    y = event->xmotion.y;
                }

                window->x11.cursorPosX = event->xmotion.x;
                window->x11.cursorPosY = event->xmotion.y;
                window->x11.cursorCentered = GL_FALSE;

                _glfwInputCursorMotion(window, x, y);
            }

            break;
        }

        case ConfigureNotify:
        {
            _glfwInputWindowSize(window,
                                 event->xconfigure.width,
                                 event->xconfigure.height);

            _glfwInputWindowPos(window,
                                event->xconfigure.x,
                                event->xconfigure.y);

            break;
        }

        case ClientMessage:
        {
            // Custom client message, probably from the window manager

            if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW)
            {
                // The window manager was asked to close the window, for example by
                // the user pressing a 'close' window decoration button

                _glfwInputWindowCloseRequest(window);
            }
            else if (_glfw.x11.NET_WM_PING != None &&
                     (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
            {
                // The window manager is pinging the application to ensure it's
                // still responding to events

                event->xclient.window = _glfw.x11.root;
                XSendEvent(_glfw.x11.display,
                           event->xclient.window,
                           False,
                           SubstructureNotifyMask | SubstructureRedirectMask,
                           event);
            }

            break;
        }

        case MapNotify:
        {
            _glfwInputWindowVisibility(window, GL_TRUE);
            break;
        }

        case UnmapNotify:
        {
            _glfwInputWindowVisibility(window, GL_FALSE);
            break;
        }

        case FocusIn:
        {
            _glfwInputWindowFocus(window, GL_TRUE);

            if (window->cursorMode == GLFW_CURSOR_CAPTURED)
                captureCursor(window);

            break;
        }

        case FocusOut:
        {
            _glfwInputWindowFocus(window, GL_FALSE);

            if (window->cursorMode == GLFW_CURSOR_CAPTURED)
                showCursor(window);

            break;
        }

        case Expose:
        {
            _glfwInputWindowDamage(window);
            break;
        }

        case PropertyNotify:
        {
            if (event->xproperty.atom == _glfw.x11.WM_STATE &&
                event->xproperty.state == PropertyNewValue)
            {
                struct {
                    CARD32 state;
                    Window icon;
                } *state = NULL;

                if (_glfwGetWindowProperty(window->x11.handle,
                                           _glfw.x11.WM_STATE,
                                           _glfw.x11.WM_STATE,
                                           (unsigned char**) &state) >= 2)
                {
                    if (state->state == IconicState)
                        _glfwInputWindowIconify(window, GL_TRUE);
                    else if (state->state == NormalState)
                        _glfwInputWindowIconify(window, GL_FALSE);
                }

                XFree(state);
            }

            break;
        }

        case SelectionClear:
        {
            // The ownership of the clipboard selection was lost

            free(_glfw.x11.selection.string);
            _glfw.x11.selection.string = NULL;
            break;
        }

        case SelectionRequest:
        {
            // The contents of the clipboard selection was requested

            XSelectionRequestEvent* request = &event->xselectionrequest;

            XEvent response;
            memset(&response, 0, sizeof(response));

            response.xselection.property = _glfwWriteSelection(request);
            response.xselection.type = SelectionNotify;
            response.xselection.display = request->display;
            response.xselection.requestor = request->requestor;
            response.xselection.selection = request->selection;
            response.xselection.target = request->target;
            response.xselection.time = request->time;

            XSendEvent(_glfw.x11.display,
                       request->requestor,
                       False, 0, &response);
            break;
        }

        case DestroyNotify:
            return;

        case GenericEvent:
        {
            if (event->xcookie.extension == _glfw.x11.xi2.majorOpcode &&
                XGetEventData(_glfw.x11.display, &event->xcookie))
            {
                if (event->xcookie.evtype == XI_Motion)
                {
                    XIDeviceEvent* data = (XIDeviceEvent*) event->xcookie.data;

                    window = _glfwFindWindowByHandle(data->event);
                    if (window)
                    {
                        if (data->event_x != window->x11.cursorPosX ||
                            data->event_y != window->x11.cursorPosY)
                        {
                            // The cursor was moved by something other than GLFW

                            double x, y;

                            if (window->cursorMode == GLFW_CURSOR_CAPTURED)
                            {
                                if (_glfw.focusedWindow != window)
                                    break;

                                x = data->event_x - window->x11.cursorPosX;
                                y = data->event_y - window->x11.cursorPosY;
                            }
                            else
                            {
                                x = data->event_x;
                                y = data->event_y;
                            }

                            window->x11.cursorPosX = data->event_x;
                            window->x11.cursorPosY = data->event_y;
                            window->x11.cursorCentered = GL_FALSE;

                            _glfwInputCursorMotion(window, x, y);
                        }
                    }
                }
            }

            XFreeEventData(_glfw.x11.display, &event->xcookie);
            break;
        }

        default:
        {
            switch (event->type - _glfw.x11.randr.eventBase)
            {
                case RRScreenChangeNotify:
                {
                    XRRUpdateConfiguration(event);
                    break;
                }
            }

            break;
        }
    }
}
Пример #10
0
int check_xrandr_event(char *msg) {
	XEvent xev;

	RAWFB_RET(0)

	/* it is assumed that X_LOCK is on at this point. */

	if (subwin) {
		return handle_subwin_resize(msg);
	}
#if LIBVNCSERVER_HAVE_LIBXRANDR
	if (! xrandr_present) {
		return 0;
	}
	if (! xrandr && ! xrandr_maybe) {
		return 0;
	}


	if (xrandr_base_event_type && XCheckTypedEvent(dpy,
	    xrandr_base_event_type + RRScreenChangeNotify, &xev)) {
		int do_change, qout = 0;
		static int first = 1;
		XRRScreenChangeNotifyEvent *rev;

		rev = (XRRScreenChangeNotifyEvent *) &xev;

		if (first && ! xrandr) {
			fprintf(stderr, "\n");
			if (getenv("X11VNC_DEBUG_XRANDR") == NULL) {
				qout = 1;
			}
		}
		first = 0;
			
		rfbLog("check_xrandr_event():\n");
		rfbLog("Detected XRANDR event at location '%s':\n", msg);

		if (qout) {
			;
		} else {
			rfbLog("  serial:          %d\n", (int) rev->serial);
			rfbLog("  timestamp:       %d\n", (int) rev->timestamp);
			rfbLog("  cfg_timestamp:   %d\n", (int) rev->config_timestamp);
			rfbLog("  size_id:         %d\n", (int) rev->size_index);
			rfbLog("  sub_pixel:       %d\n", (int) rev->subpixel_order);
			rfbLog("  rotation:        %d\n", (int) rev->rotation);
			rfbLog("  width:           %d\n", (int) rev->width);
			rfbLog("  height:          %d\n", (int) rev->height);
			rfbLog("  mwidth:          %d mm\n", (int) rev->mwidth);
			rfbLog("  mheight:         %d mm\n", (int) rev->mheight);
			rfbLog("\n");
			rfbLog("check_xrandr_event: previous WxH: %dx%d\n",
			    wdpy_x, wdpy_y);
		}

		if (wdpy_x == rev->width && wdpy_y == rev->height &&
		    xrandr_rotation == (int) rev->rotation) {
			rfbLog("check_xrandr_event: no change detected.\n");
			do_change = 0;
			if (! xrandr) {
		    		rfbLog("check_xrandr_event: "
				    "enabling full XRANDR trapping anyway.\n");
				xrandr = 1;
			}
		} else {
			do_change = 1;
			if (! xrandr) {
		    		rfbLog("check_xrandr_event: Resize; "
				    "enabling full XRANDR trapping.\n");
				xrandr = 1;
			}
		}

		xrandr_width  = rev->width;
		xrandr_height = rev->height;
		xrandr_timestamp = rev->timestamp;
		xrandr_cfg_time  = rev->config_timestamp;
		xrandr_rotation = (int) rev->rotation;

		if (! qout) rfbLog("check_xrandr_event: updating config...\n");
		XRRUpdateConfiguration(&xev);

		if (do_change) {
			/* under do_change caller normally returns before its X_UNLOCK */
			X_UNLOCK;
			handle_xrandr_change(rev->width, rev->height);
		}
		if (qout) {
			return do_change;
		}
		rfbLog("check_xrandr_event: current  WxH: %dx%d\n",
		    XDisplayWidth(dpy, scr), XDisplayHeight(dpy, scr));
		rfbLog("check_xrandr_event(): returning control to"
		    " caller...\n");


		return do_change;
	}
#else
	xev.type = 0;
#endif


	return 0;
}
Пример #11
0
// Process the specified X event
//
static void processEvent(XEvent *event)
{
    _GLFWwindow* window = NULL;

    if (event->type != GenericEvent)
    {
        window = _glfwFindWindowByHandle(event->xany.window);
        if (window == NULL)
        {
            // This is an event for a window that has already been destroyed
            return;
        }
    }

    switch (event->type)
    {
        case KeyPress:
        {
            const int key = translateKey(event->xkey.keycode);
            const int mods = translateState(event->xkey.state);
            const int character = translateChar(&event->xkey);

            _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods);

            if (character != -1)
                _glfwInputChar(window, character);

            break;
        }

        case KeyRelease:
        {
            const int key = translateKey(event->xkey.keycode);
            const int mods = translateState(event->xkey.state);

            _glfwInputKey(window, key, event->xkey.keycode, GLFW_RELEASE, mods);
            break;
        }

        case ButtonPress:
        {
            const int mods = translateState(event->xbutton.state);

            if (event->xbutton.button == Button1)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
            else if (event->xbutton.button == Button2)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
            else if (event->xbutton.button == Button3)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods);

            // Modern X provides scroll events as mouse button presses
            else if (event->xbutton.button == Button4)
                _glfwInputScroll(window, 0.0, 1.0);
            else if (event->xbutton.button == Button5)
                _glfwInputScroll(window, 0.0, -1.0);
            else if (event->xbutton.button == Button6)
                _glfwInputScroll(window, -1.0, 0.0);
            else if (event->xbutton.button == Button7)
                _glfwInputScroll(window, 1.0, 0.0);

            else
            {
                // Additional buttons after 7 are treated as regular buttons
                // We subtract 4 to fill the gap left by scroll input above
                _glfwInputMouseClick(window,
                                     event->xbutton.button - 4,
                                     GLFW_PRESS,
                                     mods);
            }

            break;
        }

        case ButtonRelease:
        {
            const int mods = translateState(event->xbutton.state);

            if (event->xbutton.button == Button1)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_LEFT,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button == Button2)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_MIDDLE,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button == Button3)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_RIGHT,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button > Button7)
            {
                // Additional buttons after 7 are treated as regular buttons
                // We subtract 4 to fill the gap left by scroll input above
                _glfwInputMouseClick(window,
                                     event->xbutton.button - 4,
                                     GLFW_RELEASE,
                                     mods);
            }
            break;
        }

        case EnterNotify:
        {
            _glfwInputCursorEnter(window, GL_TRUE);
            break;
        }

        case LeaveNotify:
        {
            _glfwInputCursorEnter(window, GL_FALSE);
            break;
        }

        case MotionNotify:
        {
            if (event->xmotion.x != window->x11.warpPosX ||
                event->xmotion.y != window->x11.warpPosY)
            {
                // The cursor was moved by something other than GLFW

                int x, y;

                if (window->cursorMode == GLFW_CURSOR_DISABLED)
                {
                    if (_glfw.focusedWindow != window)
                        break;

                    x = event->xmotion.x - window->x11.cursorPosX;
                    y = event->xmotion.y - window->x11.cursorPosY;
                }
                else
                {
                    x = event->xmotion.x;
                    y = event->xmotion.y;
                }

                _glfwInputCursorMotion(window, x, y);
            }

            window->x11.cursorPosX = event->xmotion.x;
            window->x11.cursorPosY = event->xmotion.y;
            break;
        }

        case ConfigureNotify:
        {
            if (event->xconfigure.width != window->x11.width ||
                event->xconfigure.height != window->x11.height)
            {
                _glfwInputFramebufferSize(window,
                                          event->xconfigure.width,
                                          event->xconfigure.height);

                _glfwInputWindowSize(window,
                                     event->xconfigure.width,
                                     event->xconfigure.height);

                window->x11.width = event->xconfigure.width;
                window->x11.height = event->xconfigure.height;
            }

            if (event->xconfigure.x != window->x11.xpos ||
                event->xconfigure.y != window->x11.ypos)
            {
                _glfwInputWindowPos(window,
                                    event->xconfigure.x,
                                    event->xconfigure.y);

                window->x11.xpos = event->xconfigure.x;
                window->x11.ypos = event->xconfigure.y;
            }

            break;
        }

        case ClientMessage:
        {
            // Custom client message, probably from the window manager

            if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW)
            {
                // The window manager was asked to close the window, for example by
                // the user pressing a 'close' window decoration button

                _glfwInputWindowCloseRequest(window);
            }
            else if (_glfw.x11.NET_WM_PING &&
                     (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
            {
                // The window manager is pinging the application to ensure it's
                // still responding to events

                event->xclient.window = _glfw.x11.root;
                XSendEvent(_glfw.x11.display,
                           event->xclient.window,
                           False,
                           SubstructureNotifyMask | SubstructureRedirectMask,
                           event);
            }
            else if (event->xclient.message_type == _glfw.x11.XdndEnter)
            {
                // A drag operation has entered the window
                // TODO: Check if UTF-8 string is supported by the source
            }
            else if (event->xclient.message_type == _glfw.x11.XdndDrop)
            {
                // The drag operation has finished dropping on
                // the window, ask to convert it to a UTF-8 string
                _glfw.x11.xdnd.source = event->xclient.data.l[0];
                XConvertSelection(_glfw.x11.display,
                                  _glfw.x11.XdndSelection,
                                  _glfw.x11.UTF8_STRING,
                                  _glfw.x11.XdndSelection,
                                  window->x11.handle, CurrentTime);
            }
            else if (event->xclient.message_type == _glfw.x11.XdndPosition)
            {
                // The drag operation has moved over the window
                const int absX = (event->xclient.data.l[2] >> 16) & 0xFFFF;
                const int absY = (event->xclient.data.l[2]) & 0xFFFF;
                int x, y;

                _glfwPlatformGetWindowPos(window, &x, &y);
                _glfwInputCursorMotion(window, absX - x, absY - y);

                // Reply that we are ready to copy the dragged data
                XEvent reply;
                memset(&reply, 0, sizeof(reply));

                reply.type = ClientMessage;
                reply.xclient.window = event->xclient.data.l[0];
                reply.xclient.message_type = _glfw.x11.XdndStatus;
                reply.xclient.format = 32;
                reply.xclient.data.l[0] = window->x11.handle;
                reply.xclient.data.l[1] = 1; // Always accept the dnd with no rectangle
                reply.xclient.data.l[2] = 0; // Specify an empty rectangle
                reply.xclient.data.l[3] = 0;
                reply.xclient.data.l[4] = _glfw.x11.XdndActionCopy;

                XSendEvent(_glfw.x11.display, event->xclient.data.l[0],
                           False, NoEventMask, &reply);
                XFlush(_glfw.x11.display);
            }

            break;
        }

        case SelectionNotify:
        {
            if (event->xselection.property)
            {
                // The converted data from the drag operation has arrived
                char* data;
                const int result = _glfwGetWindowProperty(event->xselection.requestor,
                                                          event->xselection.property,
                                                          event->xselection.target,
                                                          (unsigned char**) &data);

                if (result)
                {
                    int i, count;
                    char** names = splitUriList(data, &count);

                    _glfwInputDrop(window, count, (const char**) names);

                    for (i = 0;  i < count;  i++)
                        free(names[i]);
                    free(names);
                }

                XFree(data);

                XEvent reply;
                memset(&reply, 0, sizeof(reply));

                reply.type = ClientMessage;
                reply.xclient.window = _glfw.x11.xdnd.source;
                reply.xclient.message_type = _glfw.x11.XdndFinished;
                reply.xclient.format = 32;
                reply.xclient.data.l[0] = window->x11.handle;
                reply.xclient.data.l[1] = result;
                reply.xclient.data.l[2] = _glfw.x11.XdndActionCopy;

                // Reply that all is well
                XSendEvent(_glfw.x11.display, _glfw.x11.xdnd.source,
                           False, NoEventMask, &reply);
                XFlush(_glfw.x11.display);
            }

            break;
        }

        case MapNotify:
        {
            _glfwInputWindowVisibility(window, GL_TRUE);
            break;
        }

        case UnmapNotify:
        {
            _glfwInputWindowVisibility(window, GL_FALSE);
            break;
        }

        case FocusIn:
        {
            _glfwInputWindowFocus(window, GL_TRUE);

            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                disableCursor(window);

            break;
        }

        case FocusOut:
        {
            _glfwInputWindowFocus(window, GL_FALSE);

            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                restoreCursor(window);

            break;
        }

        case Expose:
        {
            _glfwInputWindowDamage(window);
            break;
        }

        case PropertyNotify:
        {
            if (event->xproperty.atom == _glfw.x11.WM_STATE &&
                event->xproperty.state == PropertyNewValue)
            {
                struct {
                    CARD32 state;
                    Window icon;
                } *state = NULL;

                if (_glfwGetWindowProperty(window->x11.handle,
                                           _glfw.x11.WM_STATE,
                                           _glfw.x11.WM_STATE,
                                           (unsigned char**) &state) >= 2)
                {
                    if (state->state == IconicState)
                        _glfwInputWindowIconify(window, GL_TRUE);
                    else if (state->state == NormalState)
                        _glfwInputWindowIconify(window, GL_FALSE);
                }

                XFree(state);
            }

            break;
        }

        case SelectionClear:
        {
            _glfwHandleSelectionClear(event);
            break;
        }

        case SelectionRequest:
        {
            _glfwHandleSelectionRequest(event);
            break;
        }

        case DestroyNotify:
            return;

        case GenericEvent:
        {
            if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
                XGetEventData(_glfw.x11.display, &event->xcookie))
            {
                if (event->xcookie.evtype == XI_Motion)
                {
                    XIDeviceEvent* data = (XIDeviceEvent*) event->xcookie.data;

                    window = _glfwFindWindowByHandle(data->event);
                    if (window)
                    {
                        if (data->event_x != window->x11.warpPosX ||
                            data->event_y != window->x11.warpPosY)
                        {
                            // The cursor was moved by something other than GLFW

                            double x, y;

                            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                            {
                                if (_glfw.focusedWindow != window)
                                    break;

                                x = data->event_x - window->x11.cursorPosX;
                                y = data->event_y - window->x11.cursorPosY;
                            }
                            else
                            {
                                x = data->event_x;
                                y = data->event_y;
                            }

                            _glfwInputCursorMotion(window, x, y);
                        }

                        window->x11.cursorPosX = data->event_x;
                        window->x11.cursorPosY = data->event_y;
                    }
                }
            }

            XFreeEventData(_glfw.x11.display, &event->xcookie);
            break;
        }

        default:
        {
            switch (event->type - _glfw.x11.randr.eventBase)
            {
                case RRScreenChangeNotify:
                {
                    XRRUpdateConfiguration(event);
                    break;
                }
            }

            break;
        }
    }
}
Пример #12
0
// Process the specified X event
//
static void processEvent(XEvent *event)
{
    _GLFWwindow* window = NULL;

    if (event->type != GenericEvent)
    {
        window = _glfwFindWindowByHandle(event->xany.window);
        if (window == NULL)
        {
            // This is an event for a window that has already been destroyed
            return;
        }
    }

    switch (event->type)
    {
        case KeyPress:
        {
            const int key = translateKey(event->xkey.keycode);
            const int mods = translateState(event->xkey.state);
            const int character = translateChar(&event->xkey);

            _glfwInputKey(window, key, event->xkey.keycode, GLFW_PRESS, mods);

            if (character != -1)
                _glfwInputChar(window, character);

            break;
        }

        case KeyRelease:
        {
            const int key = translateKey(event->xkey.keycode);
            const int mods = translateState(event->xkey.state);

            _glfwInputKey(window, key, event->xkey.keycode, GLFW_RELEASE, mods);
            break;
        }

        case ButtonPress:
        {
            const int mods = translateState(event->xbutton.state);

            if (event->xbutton.button == Button1)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS, mods);
            else if (event->xbutton.button == Button2)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_MIDDLE, GLFW_PRESS, mods);
            else if (event->xbutton.button == Button3)
                _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_RIGHT, GLFW_PRESS, mods);

            // Modern X provides scroll events as mouse button presses
            else if (event->xbutton.button == Button4)
                _glfwInputScroll(window, 0.0, 1.0);
            else if (event->xbutton.button == Button5)
                _glfwInputScroll(window, 0.0, -1.0);
            else if (event->xbutton.button == Button6)
                _glfwInputScroll(window, -1.0, 0.0);
            else if (event->xbutton.button == Button7)
                _glfwInputScroll(window, 1.0, 0.0);

            else
            {
                // Additional buttons after 7 are treated as regular buttons
                // We subtract 4 to fill the gap left by scroll input above
                _glfwInputMouseClick(window,
                                     event->xbutton.button - 4,
                                     GLFW_PRESS,
                                     mods);
            }

            break;
        }

        case ButtonRelease:
        {
            const int mods = translateState(event->xbutton.state);

            if (event->xbutton.button == Button1)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_LEFT,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button == Button2)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_MIDDLE,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button == Button3)
            {
                _glfwInputMouseClick(window,
                                     GLFW_MOUSE_BUTTON_RIGHT,
                                     GLFW_RELEASE,
                                     mods);
            }
            else if (event->xbutton.button > Button7)
            {
                // Additional buttons after 7 are treated as regular buttons
                // We subtract 4 to fill the gap left by scroll input above
                _glfwInputMouseClick(window,
                                     event->xbutton.button - 4,
                                     GLFW_RELEASE,
                                     mods);
            }
            break;
        }

        case EnterNotify:
        {
            if (window->cursorMode == GLFW_CURSOR_HIDDEN)
                hideCursor(window);

            _glfwInputCursorEnter(window, GL_TRUE);
            break;
        }

        case LeaveNotify:
        {
            if (window->cursorMode == GLFW_CURSOR_HIDDEN)
                showCursor(window);

            _glfwInputCursorEnter(window, GL_FALSE);
            break;
        }

        case MotionNotify:
        {
            if (event->xmotion.x != window->x11.warpPosX ||
                event->xmotion.y != window->x11.warpPosY)
            {
                // The cursor was moved by something other than GLFW

                int x, y;

                if (window->cursorMode == GLFW_CURSOR_DISABLED)
                {
                    if (_glfw.focusedWindow != window)
                        break;

                    x = event->xmotion.x - window->x11.cursorPosX;
                    y = event->xmotion.y - window->x11.cursorPosY;
                }
                else
                {
                    x = event->xmotion.x;
                    y = event->xmotion.y;
                }

                _glfwInputCursorMotion(window, x, y);
            }

            window->x11.cursorPosX = event->xmotion.x;
            window->x11.cursorPosY = event->xmotion.y;
            break;
        }

        case ConfigureNotify:
        {
            if (event->xconfigure.width != window->x11.width ||
                event->xconfigure.height != window->x11.height)
            {
                _glfwInputFramebufferSize(window,
                                          event->xconfigure.width,
                                          event->xconfigure.height);

                _glfwInputWindowSize(window,
                                     event->xconfigure.width,
                                     event->xconfigure.height);

                window->x11.width = event->xconfigure.width;
                window->x11.height = event->xconfigure.height;
            }

            if (event->xconfigure.x != window->x11.xpos ||
                event->xconfigure.y != window->x11.ypos)
            {
                _glfwInputWindowPos(window,
                                    event->xconfigure.x,
                                    event->xconfigure.y);

                window->x11.xpos = event->xconfigure.x;
                window->x11.ypos = event->xconfigure.y;
            }

            break;
        }

        case ClientMessage:
        {
            // Custom client message, probably from the window manager

            if ((Atom) event->xclient.data.l[0] == _glfw.x11.WM_DELETE_WINDOW)
            {
                // The window manager was asked to close the window, for example by
                // the user pressing a 'close' window decoration button

                _glfwInputWindowCloseRequest(window);
            }
            else if (_glfw.x11.NET_WM_PING &&
                     (Atom) event->xclient.data.l[0] == _glfw.x11.NET_WM_PING)
            {
                // The window manager is pinging the application to ensure it's
                // still responding to events

                event->xclient.window = _glfw.x11.root;
                XSendEvent(_glfw.x11.display,
                           event->xclient.window,
                           False,
                           SubstructureNotifyMask | SubstructureRedirectMask,
                           event);
            }

            break;
        }

        case MapNotify:
        {
            _glfwInputWindowVisibility(window, GL_TRUE);
            break;
        }

        case UnmapNotify:
        {
            _glfwInputWindowVisibility(window, GL_FALSE);
            break;
        }

        case FocusIn:
        {
            _glfwInputWindowFocus(window, GL_TRUE);

            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                captureCursor(window);

            break;
        }

        case FocusOut:
        {
            _glfwInputWindowFocus(window, GL_FALSE);

            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                showCursor(window);

            break;
        }

        case Expose:
        {
            _glfwInputWindowDamage(window);
            break;
        }

        case PropertyNotify:
        {
            if (event->xproperty.atom == _glfw.x11.WM_STATE &&
                event->xproperty.state == PropertyNewValue)
            {
                struct {
                    CARD32 state;
                    Window icon;
                } *state = NULL;

                if (_glfwGetWindowProperty(window->x11.handle,
                                           _glfw.x11.WM_STATE,
                                           _glfw.x11.WM_STATE,
                                           (unsigned char**) &state) >= 2)
                {
                    if (state->state == IconicState)
                        _glfwInputWindowIconify(window, GL_TRUE);
                    else if (state->state == NormalState)
                        _glfwInputWindowIconify(window, GL_FALSE);
                }

                XFree(state);
            }

            break;
        }

        case SelectionClear:
        {
            _glfwHandleSelectionClear(event);
            break;
        }

        case SelectionRequest:
        {
            _glfwHandleSelectionRequest(event);
            break;
        }

        case DestroyNotify:
            return;

        case GenericEvent:
        {
            if (event->xcookie.extension == _glfw.x11.xi.majorOpcode &&
                XGetEventData(_glfw.x11.display, &event->xcookie))
            {
                if (event->xcookie.evtype == XI_Motion)
                {
                    XIDeviceEvent* data = (XIDeviceEvent*) event->xcookie.data;

                    window = _glfwFindWindowByHandle(data->event);
                    if (window)
                    {
                        if (data->event_x != window->x11.warpPosX ||
                            data->event_y != window->x11.warpPosY)
                        {
                            // The cursor was moved by something other than GLFW

                            double x, y;

                            if (window->cursorMode == GLFW_CURSOR_DISABLED)
                            {
                                if (_glfw.focusedWindow != window)
                                    break;

                                x = data->event_x - window->x11.cursorPosX;
                                y = data->event_y - window->x11.cursorPosY;
                            }
                            else
                            {
                                x = data->event_x;
                                y = data->event_y;
                            }

                            _glfwInputCursorMotion(window, x, y);
                        }

                        window->x11.cursorPosX = data->event_x;
                        window->x11.cursorPosY = data->event_y;
                    }
                }
            }

            XFreeEventData(_glfw.x11.display, &event->xcookie);
            break;
        }

        default:
        {
            switch (event->type - _glfw.x11.randr.eventBase)
            {
                case RRScreenChangeNotify:
                {
                    XRRUpdateConfiguration(event);
                    break;
                }
            }

            break;
        }
    }
}