More key event work. Added SetDetectableAutoRepeat.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2503 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
25dd56b1d3
commit
f0492f7d97
@ -84,6 +84,11 @@ WXDLLEXPORT int wxGetOsVersion(int *majorVsn= (int *) NULL,int *minorVsn= (int *
|
||||
// Return a string with the current date/time
|
||||
WXDLLEXPORT wxString wxNow();
|
||||
|
||||
// Synthesize KeyUp events holding down a key and producing
|
||||
// KeyDown events with autorepeat. On by default an always
|
||||
// on in wxMSW.
|
||||
WXDLLEXPORT bool wxSetDetectableAutoRepeat( bool flag );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Window ID management
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -355,6 +355,16 @@ StringMatch (char *str1, char *str2, bool subString, bool exact)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Synthesize KeyUp events holding down a key and producing
|
||||
// KeyDown events with autorepeat. On by default an always
|
||||
// on in wxMSW. wxGTK version in utilsgtk.cpp.
|
||||
#ifndef __WXGTK__
|
||||
bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
|
||||
{
|
||||
return TRUE; // detectable auto-repeat is the only mode MSW supports
|
||||
}
|
||||
#endif
|
||||
|
||||
// Return the current date/time
|
||||
// [volatile]
|
||||
wxString wxNow( void )
|
||||
|
@ -596,6 +596,8 @@ int wxEntry( int argc, char *argv[] )
|
||||
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
wxSetDetectableAutoRepeat( TRUE );
|
||||
|
||||
if (!wxApp::Initialize())
|
||||
return -1;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkfeatures.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "X11/XKBlib.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// misc.
|
||||
@ -45,6 +46,15 @@ void wxBell()
|
||||
gdk_beep();
|
||||
}
|
||||
|
||||
// Synthesize KeyUp events holding down a key and producing
|
||||
// KeyDown events with autorepeat.
|
||||
bool wxSetDetectableAutoRepeat( bool flag )
|
||||
{
|
||||
Bool result;
|
||||
XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
|
||||
return result; // true if keyboard hardware supports this mode
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// display characterstics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -563,8 +563,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
printf( "\n" );
|
||||
*/
|
||||
|
||||
bool ret = FALSE;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GdkModifierType state;
|
||||
@ -572,6 +570,11 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
|
||||
long key_code = get_unmodified_wx_keysym( gdk_event );
|
||||
|
||||
/* sending unknown key events doesn't really make sense */
|
||||
if (key_code == 0) return FALSE;
|
||||
|
||||
bool ret = FALSE;
|
||||
|
||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||
event.SetTimestamp( gdk_event->time );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
@ -702,6 +705,9 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
|
||||
*/
|
||||
|
||||
long key_code = get_unmodified_wx_keysym( gdk_event );
|
||||
|
||||
/* sending unknown key events doesn't really make sense */
|
||||
if (key_code == 0) return FALSE;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
@ -596,6 +596,8 @@ int wxEntry( int argc, char *argv[] )
|
||||
|
||||
gtk_init( &argc, &argv );
|
||||
|
||||
wxSetDetectableAutoRepeat( TRUE );
|
||||
|
||||
if (!wxApp::Initialize())
|
||||
return -1;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtkfeatures.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "X11/XKBlib.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// misc.
|
||||
@ -45,6 +46,15 @@ void wxBell()
|
||||
gdk_beep();
|
||||
}
|
||||
|
||||
// Synthesize KeyUp events holding down a key and producing
|
||||
// KeyDown events with autorepeat.
|
||||
bool wxSetDetectableAutoRepeat( bool flag )
|
||||
{
|
||||
Bool result;
|
||||
XkbSetDetectableAutoRepeat( GDK_DISPLAY(), flag, &result );
|
||||
return result; // true if keyboard hardware supports this mode
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// display characterstics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -563,8 +563,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
printf( "\n" );
|
||||
*/
|
||||
|
||||
bool ret = FALSE;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
GdkModifierType state;
|
||||
@ -572,6 +570,11 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
|
||||
long key_code = get_unmodified_wx_keysym( gdk_event );
|
||||
|
||||
/* sending unknown key events doesn't really make sense */
|
||||
if (key_code == 0) return FALSE;
|
||||
|
||||
bool ret = FALSE;
|
||||
|
||||
wxKeyEvent event( wxEVT_KEY_DOWN );
|
||||
event.SetTimestamp( gdk_event->time );
|
||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||
@ -702,6 +705,9 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
|
||||
*/
|
||||
|
||||
long key_code = get_unmodified_wx_keysym( gdk_event );
|
||||
|
||||
/* sending unknown key events doesn't really make sense */
|
||||
if (key_code == 0) return FALSE;
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user