summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/context_gl_x11.cpp2
-rw-r--r--platform/x11/os_x11.cpp36
-rw-r--r--platform/x11/os_x11.h2
3 files changed, 18 insertions, 22 deletions
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index be4061fb93..b56b54822e 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -92,7 +92,7 @@ Error ContextGL_X11::initialize() {
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
- GLX_DEPTH_SIZE,0,
+ GLX_DEPTH_SIZE, 24,
None
};
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 2cb8247799..14d31b864c 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -480,7 +480,7 @@ unsigned int OS_X11::get_mouse_button_state(unsigned int p_x11_state) {
return state;
}
-void OS_X11::handle_key_event(XKeyEvent *p_event) {
+void OS_X11::handle_key_event(XKeyEvent *p_event, bool p_echo) {
// X11 functions don't know what const is
@@ -591,17 +591,9 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) {
// To detect them, i use XPeekEvent and check that their
// difference in time is below a treshold.
- bool echo=false;
-
- if (xkeyevent->type == KeyPress) {
-
- // saved the time of the last keyrelease to see
- // if it's the same as this keypress.
- if (xkeyevent->time==last_keyrelease_time)
- echo=true;
- } else {
-
+ if (xkeyevent->type != KeyPress) {
+
// make sure there are events pending,
// so this call won't block.
if (XPending(x11_display)>0) {
@@ -615,17 +607,21 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) {
// not very helpful today.
::Time tresh=ABS(peek_event.xkey.time-xkeyevent->time);
- if (peek_event.type == KeyPress && tresh<5 )
- echo=true;
+ if (peek_event.type == KeyPress && tresh<5 ) {
+ KeySym rk;
+ nbytes=XLookupString((XKeyEvent*)&peek_event, str, 256, &rk, NULL);
+ if (rk==keysym_keycode) {
+ XEvent event;
+ XNextEvent(x11_display, &event); //erase next event
+ handle_key_event( (XKeyEvent*)&event,true );
+ return; //ignore current, echo next
+ }
+ }
// use the time from peek_event so it always works
- last_keyrelease_time=peek_event.xkey.time;
- } else {
- last_keyrelease_time=xkeyevent->time;
}
- // save the time to check for echo when keypress happens
-
+ // save the time to check for echo when keypress happens
}
@@ -643,7 +639,7 @@ void OS_X11::handle_key_event(XKeyEvent *p_event) {
event.key.scancode=keycode;
event.key.unicode=unicode;
- event.key.echo=echo;
+ event.key.echo=p_echo;
if (event.key.scancode==KEY_BACKTAB) {
//make it consistent accross platforms.
@@ -1017,7 +1013,7 @@ String OS_X11::get_name() {
Error OS_X11::shell_open(String p_uri) {
-
+ return ERR_UNAVAILABLE;
}
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 491b8fa00d..77ef37f6f4 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -90,7 +90,7 @@ class OS_X11 : public OS_Unix {
MouseMode mouse_mode;
Point2i center;
- void handle_key_event(XKeyEvent *p_event);
+ void handle_key_event(XKeyEvent *p_event,bool p_echo=false);
void process_xevents();
virtual void delete_main_loop();
IP_Unix *ip_unix;