X11: remove grabbing of keyboard and mouse
authorRainer Hochecker <fernetmenta@online.de>
Thu, 31 Oct 2013 08:37:13 +0000 (09:37 +0100)
committerRainer Hochecker <fernetmenta@online.de>
Tue, 29 Apr 2014 10:31:42 +0000 (12:31 +0200)
xbmc/windowing/WinEventsX11.cpp
xbmc/windowing/X11/WinSystemX11.cpp
xbmc/windowing/X11/WinSystemX11.h

index 0b8bba5..39980a8 100644 (file)
@@ -538,16 +538,12 @@ bool CWinEventsX11Imp::MessagePump()
 
       case EnterNotify:
       {
-        if (xevent.xcrossing.mode ==  NotifyNormal)
-          g_Windowing.NotifyMouseCoverage(true);
         break;
       }
 
       // lose mouse coverage
       case LeaveNotify:
       {
-        if (xevent.xcrossing.mode ==  NotifyNormal)
-          g_Windowing.NotifyMouseCoverage(false);
         g_Mouse.SetActive(false);
         break;
       }
index f806ac2..696e9a3 100644 (file)
@@ -153,8 +153,6 @@ bool CWinSystemX11::DestroyWindow()
 
   XUnmapWindow(m_dpy, m_mainWindow);
   XSync(m_dpy,TRUE);
-  XUngrabKeyboard(m_dpy, CurrentTime);
-  XUngrabPointer(m_dpy, CurrentTime);
   XDestroyWindow(m_dpy, m_glWindow);
   XDestroyWindow(m_dpy, m_mainWindow);
   m_glWindow = 0;
@@ -628,30 +626,6 @@ void CWinSystemX11::NotifyAppFocusChange(bool bGaining)
     m_bIgnoreNextFocusMessage = false;
 }
 
-void CWinSystemX11::NotifyMouseCoverage(bool covered)
-{
-  if (!m_bFullScreen || !m_mainWindow)
-    return;
-
-  if (covered && !m_bIsGrabbed)
-  {
-    int result = -1;
-    while (result != GrabSuccess && result != AlreadyGrabbed)
-    {
-      result = XGrabPointer(m_dpy, m_mainWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
-      XbmcThreads::ThreadSleep(100);
-    }
-    XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime);
-    m_bIsGrabbed = true;
-  }
-  else if (!covered && m_bIsGrabbed)
-  {
-    XUngrabKeyboard(m_dpy, CurrentTime);
-    XUngrabPointer(m_dpy, CurrentTime);
-    m_bIsGrabbed = false;
-  }
-}
-
 bool CWinSystemX11::Minimize()
 {
   m_bWasFullScreenBeforeMinimize = m_bFullScreen;
@@ -1002,20 +976,6 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const std:
       XWarpPointer(m_dpy, None, m_mainWindow, 0, 0, 0, 0, mouseX*width, mouseY*height);
     }
 
-    if (fullscreen)
-    {
-      int result = -1;
-      while (result != GrabSuccess && result != AlreadyGrabbed)
-      {
-        result = XGrabPointer(m_dpy, m_mainWindow, True, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
-        XbmcThreads::ThreadSleep(100);
-      }
-      XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime);
-      m_bIsGrabbed = true;
-    }
-    else
-      m_bIsGrabbed = false;
-
     CDirtyRegionList dr;
     RefreshGlxContext(m_currentOutput.compare(output) != 0);
     XSync(m_dpy, FALSE);
index dcec946..5489543 100644 (file)
@@ -72,7 +72,6 @@ public:
   void NotifyXRREvent();
   void GetConnectedOutputs(std::vector<CStdString> *outputs);
   bool IsCurrentOutput(CStdString output);
-  void NotifyMouseCoverage(bool covered);
 
 protected:
   bool RefreshGlxContext(bool force);
@@ -89,7 +88,6 @@ protected:
   bool         m_bWasFullScreenBeforeMinimize;
   bool         m_minimized;
   bool         m_bIgnoreNextFocusMessage;
-  bool         m_bIsGrabbed;
   int          m_RREventBase;
   CCriticalSection             m_resourceSection;
   std::vector<IDispResource*>  m_resources;