From 13ae577973bc4402f21ab6d547f423f2f95c5157 Mon Sep 17 00:00:00 2001 From: graemeg Date: Fri, 20 Mar 2009 14:28:21 +0000 Subject: * Minor X11 debugging improvements. * Named internal components * Introduced TfpgBaseCheckbox class. * Refactored text drawing in ComboBox to a method that can be overridden in descendants. * Implemented a new (experimental) Calendar Combo with Checkbox for optional date selection. * Added Calendar Combo Check component to UI Designer. * Fixed some missing properties from Calendar Combo component in UI Designer. --- src/corelib/x11/fpg_x11.pas | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/corelib/x11') diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 6aad85d0..a906ff2b 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -118,8 +118,6 @@ type TfpgWindowImpl = class; - { TfpgFontResourceImpl } - TfpgFontResourceImpl = class(TfpgFontResourceBase) private FFontData: PXftFont; @@ -949,7 +947,11 @@ begin {$IFDEF DEBUG} - WriteLn('Event ',GetXEventName(ev._type),': ', ev._type,' window: ', ev.xany.window); + w := FindWindowByHandle(ev.xany.window); + if not Assigned(w) then + WriteLn('Event ',GetXEventName(ev._type),'(', ev._type,') window: ', IntToHex(ev.xany.window,7)) + else + WriteLn('Event ',GetXEventName(ev._type),'(', ev._type,') window: ', IntToHex(ev.xany.window,7), ' name:', w.Name); // PrintKeyEvent(ev); { debug purposes only } {$ENDIF} @@ -989,11 +991,16 @@ begin msgp.keyboard.keycode := KeySymToKeycode(KeySym); msgp.keyboard.shiftstate := ConvertShiftState(ev.xkey.state); + // By default X11 sends keyboard event to window under mouse cursor. + // We need to get the corrected "focused" widget instead. kwg := FindKeyboardFocus; if kwg <> nil then w := kwg else begin + {$IFDEF DEBUG} + writeln('ERR: We couldn''t find keyboard focused window. Using event window instead!'); + {$ENDIF} w := FindWindowByHandle(ev.xkey.window); if not Assigned(w) then ReportLostWindow(ev); -- cgit v1.2.3-70-g09d2