summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-07 09:51:23 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-07 09:51:23 +0000
commit27b4260ca539231514aa053706c060eff1568695 (patch)
tree6f36651eb45d5b2c163eaeda21a0474eb84a6be4
parentf11fffeb438a1d3457629d183fe96657d12c9546 (diff)
downloadfpGUI-27b4260ca539231514aa053706c060eff1568695.tar.xz
* Fixed a minor bug where the CoreLib examples did not show the main window
-rw-r--r--examples/corelib/eventtest/eventtest.lpr1
-rw-r--r--examples/corelib/helloworld/helloworld.pas9
-rw-r--r--src/corelib/x11/gfx_x11.pas33
3 files changed, 38 insertions, 5 deletions
diff --git a/examples/corelib/eventtest/eventtest.lpr b/examples/corelib/eventtest/eventtest.lpr
index 5ba36a09..46556971 100644
--- a/examples/corelib/eventtest/eventtest.lpr
+++ b/examples/corelib/eventtest/eventtest.lpr
@@ -225,6 +225,7 @@ end;
procedure TMainForm.Show;
begin
AllocateWindowHandle;
+ DoSetWindowVisible(True);
// We can't set a title if we don't have a window handle. So we do that here
// and not in the constructor.
SetWindowTitle('fpGFX event test');
diff --git a/examples/corelib/helloworld/helloworld.pas b/examples/corelib/helloworld/helloworld.pas
index 52e56158..93176687 100644
--- a/examples/corelib/helloworld/helloworld.pas
+++ b/examples/corelib/helloworld/helloworld.pas
@@ -52,6 +52,7 @@ end;
procedure TMainWindow.Show;
begin
AllocateWindowHandle;
+ DoSetWindowVisible(True);
// We can't set a title if we don't have a window handle. So we do that here
// and not in the constructor.
SetWindowTitle('fpGFX Hello World');
@@ -60,20 +61,20 @@ end;
procedure TMainWindow.MsgPaint(var msg: TfpgMessageRec);
var
Color: TfpgColor;
- r: TfpgRect;
+ r: TRect;
i: Integer;
begin
Canvas.BeginDraw; // begin double buffering
Color := 0;
r.Left := 0;
- r.Width := FWidth;
+ r.Right := FWidth-1;
for i := 0 to FHeight-1 do
begin
Color := $ff - (i * $ff) div FHeight; // shades of Blue
Canvas.SetColor(Color);
r.Top := i;
- r.Height := i + 1;
+ r.Bottom := i + 1;
Canvas.DrawRectangle(r);
end;
@@ -87,7 +88,7 @@ begin
Canvas.DrawString((Width - Canvas.Font.TextWidth(HelloWorldString)) div 2 - 1,
(Height - Canvas.Font.Height) div 2 - 1, HelloWorldString);
- Canvas.EndDraw(0, 0, FWidth, FHeight);
+ Canvas.EndDraw;
end;
procedure TMainWindow.MsgClose(var msg: TfpgMessageRec);
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index 65d14754..fce95e78 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -2,7 +2,7 @@ unit gfx_x11;
{$mode objfpc}{$H+}
-{$Define DEBUG}
+{.$Define DEBUG}
interface
@@ -615,6 +615,36 @@ var
rfds: TFDSet;
xfd: integer;
KeySym: TKeySym;
+
+ // debug purposes only
+ procedure PrintKeyEvent(const event: TXEvent);
+ var
+ keysym: TKeySym;
+ compose_status: TXComposeStatus;
+ length: integer;
+ s: string[10];
+ begin
+ case event._type of
+ X.KeyPress:
+ begin
+ write('*** KeyPress ');
+ end;
+ X.KeyRelease:
+ begin
+ write('*** KeyRelease ');
+ end;
+ else
+ begin
+ writeln('not a key event ');
+ end;
+ end;
+ length := XLookupString(@event, @s[1], 9, @keysym, @compose_status);
+ SetLength(s, length);
+ if((length > 0) and (length <=9)) then
+ writeln('result of xlookupstring [' + s + ']');
+ writeln(Format('*** keysym [%s] ', [XKeysymToString(keysym)]));
+ end;
+
begin
xfd := XConnectionNumber(display);
@@ -643,6 +673,7 @@ begin
exit;
// WriteLn('Event ',GetXEventName(ev._type),': ', ev._type,' window: ', ev.xany.window);
+// PrintKeyEvent(ev); { debug purposes only }
case ev._type of
X.KeyPress,