CELayoutEditor keyboard not working under wxGTK

Use this forum for:
- Discussion regarding unofficial CEGUI related tools, scripts and utilities.
- User to user help for the obsoleted CELayoutEditor and CEImagesetEditor tools.

Moderators: CEGUI MVP, CEGUI Team

iWerner
Just popping in
Just popping in
Posts: 1
Joined: Tue Nov 23, 2010 09:44

CELayoutEditor keyboard not working under wxGTK

Postby iWerner » Tue Nov 23, 2010 10:59

Hi all,

When you run the CELayoutEditor in a wxGTK environment (I'm using v0.6.3 of the layout editor on Fedora 12) the EditorCanvas does not receive keyboard events, so the 'wasd' keys that moves the widgets as well as the 'g' ("snap to grid") key does not work.

The problem can be easily solved by handling an EVT_ENTER_WINDOW event and calling the SetFocus() of the wxGLCanvas in the handler.

This post describes the problem and its solution: http://old.nabble.com/wxGLCanvas-Key-events-broken-with-2.8--td17232036.html

I've created a patch that resolves this issue, which I've attached below:

Code: Select all

diff -ruN CELayoutEditor-0.6.3.new/inc/EditorCanvas.h CELayoutEditor-0.6.3/inc/EditorCanvas.h
--- CELayoutEditor-0.6.3.new/inc/EditorCanvas.h   2010-11-23 11:37:48.712273604 +0200
+++ CELayoutEditor-0.6.3/inc/EditorCanvas.h   2009-03-18 23:33:48.000000000 +0200
@@ -105,10 +105,6 @@
 
     /** Event handler: we handle mouse input here.*/
     void OnMouseMotion(wxMouseEvent& event);
-   
-    /** Event handler: when the mouse enters the canvas, we need to call
-     * SetFocus() to be able to get keyboard events in wxGTK */
-    void OnMouseEnter(wxMouseEvent& event);
 
     /** Event handler: we handle mouse input here.*/
     void OnLeftDown(wxMouseEvent& event);
diff -ruN CELayoutEditor-0.6.3.new/src/EditorCanvas.cpp CELayoutEditor-0.6.3/src/EditorCanvas.cpp
--- CELayoutEditor-0.6.3.new/src/EditorCanvas.cpp   2010-11-23 11:35:00.206337142 +0200
+++ CELayoutEditor-0.6.3/src/EditorCanvas.cpp   2009-05-01 17:46:39.000000000 +0200
@@ -35,7 +35,6 @@
 BEGIN_EVENT_TABLE(EditorCanvas, wxGLCanvas)
 EVT_PAINT            (EditorCanvas::OnPaint)
 EVT_MOTION            (EditorCanvas::OnMouseMotion)
-EVT_ENTER_WINDOW      (EditorCanvas::OnMouseEnter)
 EVT_LEFT_DOWN         (EditorCanvas::OnLeftDown)
 EVT_LEFT_UP            (EditorCanvas::OnLeftUp)
 EVT_KEY_DOWN         (EditorCanvas::OnKeyDown)
@@ -119,12 +118,6 @@
 }
 
 //------------------------------------------------------------------------
-void EditorCanvas::OnMouseEnter(wxMouseEvent& event)
-{
-    SetFocus();
-}
-
-//------------------------------------------------------------------------
 void EditorCanvas::OnLeftDown(wxMouseEvent& event)
 {
     // Check this, because we might get this event during document closing


It can be applied by typing patch -p1 -R < ../keyboard.patch in the CELayoutEditor-0.6.3 directory where you untarred the source code.

Regards,
Werner

Return to “Unofficial CEGUI-Related Tools”

Who is online

Users browsing this forum: No registered users and 2 guests