Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

X11: use xserver defined key repeat instead of internal

  • Loading branch information...
commit 58fd64b194e38b73b5f3132744bab35e994e7441 1 parent f51b37d
@elupus authored
Showing with 8 additions and 44 deletions.
  1. +7 −41 xbmc/windowing/WinEventsX11.cpp
  2. +1 −3 xbmc/windowing/WinEventsX11.h
View
48 xbmc/windowing/WinEventsX11.cpp
@@ -193,7 +193,6 @@ CWinEventsX11::CWinEventsX11(Display *dpy, Window win)
m_keybuf = (char*)malloc(m_keybuf_len);
m_keymodState = 0;
m_wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- memset(&(m_lastKey), 0, sizeof(XBMC_Event));
memset(&m_compose, 0, sizeof(m_compose));
// open input method
@@ -324,7 +323,7 @@ bool CWinEventsX11::ProcessKeyPress(XKeyEvent& xevent)
newEvent.key.keysym.unicode = keys[i];
newEvent.key.state = XBMC_PRESSED;
newEvent.key.type = XBMC_KEYDOWN;
- ret |= ProcessKey(newEvent, 500);
+ ret |= ProcessKey(newEvent);
}
if (keys.length() > 0)
{
@@ -333,7 +332,7 @@ bool CWinEventsX11::ProcessKeyPress(XKeyEvent& xevent)
newEvent.key.keysym.unicode = keys[keys.length() - 1];
newEvent.key.state = XBMC_PRESSED;
newEvent.key.type = XBMC_KEYDOWN;
- ret |= ProcessKey(newEvent, 500);
+ ret |= ProcessKey(newEvent);
}
break;
}
@@ -344,7 +343,7 @@ bool CWinEventsX11::ProcessKeyPress(XKeyEvent& xevent)
newEvent.key.keysym.sym = LookupXbmcKeySym(xkeysym);
newEvent.key.state = XBMC_PRESSED;
newEvent.key.type = XBMC_KEYDOWN;
- ret |= ProcessKey(newEvent, 500);
+ ret |= ProcessKey(newEvent);
break;
}
@@ -355,7 +354,7 @@ bool CWinEventsX11::ProcessKeyPress(XKeyEvent& xevent)
bool CWinEventsX11::ProcessKeyRelease(XKeyEvent& xkey)
{
-#if(0)
+ /* if we have a queued press directly after, this is a repeat */
if( XEventsQueued( m_display, QueuedAfterReading ) )
{
XEvent next_event;
@@ -366,13 +365,13 @@ bool CWinEventsX11::ProcessKeyRelease(XKeyEvent& xkey)
&& next_event.xkey.time == xkey.time )
return false;
}
-#endif
+
XBMC_Event newEvent = {0};
newEvent.key.keysym.scancode = xkey.keycode;
newEvent.key.keysym.sym = LookupXbmcKeySym(XLookupKeysym(&xkey, 0));
newEvent.key.state = XBMC_RELEASED;
newEvent.key.type = XBMC_KEYUP;
- return ProcessKey(newEvent, 0);
+ return ProcessKey(newEvent);
}
bool CWinEventsX11::ProcessConfigure (XConfigureEvent& xevent)
@@ -483,7 +482,6 @@ bool CWinEventsX11::ProcessFocusIn(XFocusInEvent& xfocus)
XSetICFocus(m_xic);
g_application.m_AppFocused = true;
- memset(&(m_lastKey), 0, sizeof (XBMC_Event));
m_keymodState = 0;
g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused);
return true;
@@ -495,7 +493,6 @@ bool CWinEventsX11::ProcessFocusOut(XFocusOutEvent& xfocus)
XUnsetICFocus(m_xic);
g_application.m_AppFocused = false;
- memset(&(m_lastKey), 0, sizeof(XBMC_Event));
g_Windowing.NotifyAppFocusChange(g_application.m_AppFocused);
return true;
}
@@ -510,20 +507,6 @@ bool CWinEventsX11::Process()
memset(&xevent, 0, sizeof (XEvent));
XNextEvent(m_display, &xevent);
- // ignore events generated by auto-repeat
- if (xevent.type == KeyRelease && XPending(m_display))
- {
- XEvent peekevent;
- XPeekEvent(m_display, &peekevent);
- if ((peekevent.type == KeyPress) &&
- (peekevent.xkey.keycode == xevent.xkey.keycode) &&
- ((peekevent.xkey.time - xevent.xkey.time) < 2))
- {
- XNextEvent(m_display, &peekevent);
- continue;
- }
- }
-
if (XFilterEvent(&xevent, None))
continue;
@@ -623,8 +606,6 @@ bool CWinEventsX11::Process()
}// while
- ret |= ProcessKeyRepeat();
-
#ifdef HAS_SDL_JOYSTICK
SDL_Event event;
while (SDL_PollEvent(&event))
@@ -650,7 +631,7 @@ bool CWinEventsX11::Process()
return ret;
}
-bool CWinEventsX11::ProcessKey(XBMC_Event &event, int repeatDelay)
+bool CWinEventsX11::ProcessKey(XBMC_Event &event)
{
if (event.type == XBMC_KEYDOWN)
{
@@ -688,8 +669,6 @@ bool CWinEventsX11::ProcessKey(XBMC_Event &event, int repeatDelay)
break;
}
event.key.keysym.mod = (XBMCMod)m_keymodState;
- memcpy(&(m_lastKey), &event, sizeof(event));
- m_repeatKeyTimeout.Set(repeatDelay);
bool ret = ProcessShortcuts(event);
if (ret)
@@ -730,7 +709,6 @@ bool CWinEventsX11::ProcessKey(XBMC_Event &event, int repeatDelay)
break;
}
event.key.keysym.mod = (XBMCMod)m_keymodState;
- memset(&(m_lastKey), 0, sizeof(event));
}
return g_application.OnEvent(event);
@@ -753,18 +731,6 @@ bool CWinEventsX11::ProcessShortcuts(XBMC_Event& event)
return false;
}
-bool CWinEventsX11::ProcessKeyRepeat()
-{
- if (WinEvents && (m_lastKey.type == XBMC_KEYDOWN))
- {
- if (m_repeatKeyTimeout.IsTimePast())
- {
- return ProcessKey(m_lastKey, 10);
- }
- }
- return false;
-}
-
XBMCKey CWinEventsX11::LookupXbmcKeySym(KeySym keysym)
{
// try direct mapping first
View
4 xbmc/windowing/WinEventsX11.h
@@ -49,7 +49,7 @@ class CWinEventsX11 : public CWinEventsBase
bool ProcessFocusOut (XFocusOutEvent& xfocus);
bool ProcessEnter (XCrossingEvent& xcrossing);
bool ProcessLeave (XCrossingEvent& xcrossing);
- bool ProcessKey(XBMC_Event &event, int repeatDelay);
+ bool ProcessKey (XBMC_Event &event);
bool ProcessKeyRepeat();
bool ProcessShortcuts(XBMC_Event& event);
static CWinEventsX11 *WinEvents;
@@ -60,9 +60,7 @@ class CWinEventsX11 : public CWinEventsBase
size_t m_keybuf_len;
XIM m_xim;
XIC m_xic;
- XBMC_Event m_lastKey;
XComposeStatus m_compose;
- XbmcThreads::EndTime m_repeatKeyTimeout;
std::map<uint32_t,uint32_t> m_symLookupTable;
int m_keymodState;
int m_RREventBase;
Please sign in to comment.
Something went wrong with that request. Please try again.