Skip to content

Commit

Permalink
X11: fix mouse coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Oct 2, 2013
1 parent c9488c9 commit 472a614
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xbmc/windowing/X11/WinSystemX11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,10 @@ void CWinSystemX11::NotifyAppFocusChange(bool bGaining)

void CWinSystemX11::NotifyMouseCoverage(bool covered)
{
if (!m_bFullScreen)
if (!m_bFullScreen || !m_mainWindow)
return;

if (covered)
if (covered && !m_bIsGrabbed)
{
int result = -1;
while (result != GrabSuccess && result != AlreadyGrabbed)
Expand All @@ -593,11 +593,13 @@ void CWinSystemX11::NotifyMouseCoverage(bool covered)
XbmcThreads::ThreadSleep(100);
}
XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime);
m_bIsGrabbed = true;
}
else
else if (!covered && m_bIsGrabbed)
{
XUngrabKeyboard(m_dpy, CurrentTime);
XUngrabPointer(m_dpy, CurrentTime);
m_bIsGrabbed = false;
}
}

Expand Down Expand Up @@ -953,7 +955,10 @@ bool CWinSystemX11::SetWindow(int width, int height, bool fullscreen, const CStd
XbmcThreads::ThreadSleep(100);
}
XGrabKeyboard(m_dpy, m_mainWindow, True, GrabModeAsync, GrabModeAsync, CurrentTime);
m_bIsGrabbed = true;
}
else
m_bIsGrabbed = false;

CDirtyRegionList dr;
RefreshGlxContext(!m_currentOutput.Equals(output));
Expand Down
1 change: 1 addition & 0 deletions xbmc/windowing/X11/WinSystemX11.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class CWinSystemX11 : public CWinSystemBase
bool m_bWasFullScreenBeforeMinimize;
bool m_minimized;
bool m_bIgnoreNextFocusMessage;
bool m_bIsGrabbed;
int m_RREventBase;
CCriticalSection m_resourceSection;
std::vector<IDispResource*> m_resources;
Expand Down

0 comments on commit 472a614

Please sign in to comment.