summaryrefslogtreecommitdiff
path: root/gfx/x11/gfx_x11.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-01-23 14:48:31 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2007-01-23 14:48:31 +0000
commitc0fe0b96fa12d2ce8b7ff0d2d929c5b2181135f7 (patch)
tree59e9a7de4871633cafdfaf77e442c0d656d582ce /gfx/x11/gfx_x11.pas
parent07a6706d95e5a97e610eba483b13217367a193d3 (diff)
downloadfpGUI-c0fe0b96fa12d2ce8b7ff0d2d929c5b2181135f7.tar.xz
* MouseLeaveCheck no fires off a MouseEnter and MouseLeave event for widgets.
This makes writing other widgets easier. * Fixed the button size of the TComboBox widget. * Fixed the examples/gui/helloworld application. * Added a extras directory where we can store all kinds of stuff. Currently I added a Lazarus code template for creating a new fpGUI application. * Fixed a bug in fpGFX/X11 where the OnEnter event was checked when in actual fact the OnLeave event occured. * Fixed up some code to start Xft support for Linux again. * Internal or composite widgets like the Button in the ComboBox are now named with a hash and then the name.
Diffstat (limited to 'gfx/x11/gfx_x11.pas')
-rw-r--r--gfx/x11/gfx_x11.pas40
1 files changed, 24 insertions, 16 deletions
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index d8d49fbf..9285e49e 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -30,7 +30,7 @@ uses
SysUtils, Classes, // FPC units
X, XLib, XUtil, // X11 units
{$IFDEF XftSupport}
- unitxft; // Xft font support
+ unitxft, // Xft font support
{$ENDIF}
GfxBase, // fpGFX units
GELDirty; // fpGFX emulation layer
@@ -257,7 +257,12 @@ function GetXEventName(Event: LongInt): String;
implementation
uses
- GELImage, fpGFX;
+ GELImage
+ ,fpGFX
+ {$IFDEF XftSupport}
+ ,schar16 // Unicode support
+ {$ENDIF}
+ ;
resourcestring
SFontCreationFailed = 'Could not create font with descriptor "%s"';
@@ -334,9 +339,9 @@ begin
// FBufferWin := -1;
// FXftDrawBuffer := nil;
{$ENDIF}
- FXftDraw := XftDrawCreate(gApplication.Handle, Handle,
- XDefaultVisual(gApplication.Handle, XDefaultScreen(gApplication.Handle)),
- XDefaultColormap(gApplication.Handle, XDefaultScreen(gApplication.Handle)));
+ FXftDraw := XftDrawCreate(GFApplication.Handle, Handle,
+ XDefaultVisual(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)),
+ XDefaultColormap(GFApplication.Handle, XDefaultScreen(GFApplication.Handle)));
{$ENDIF XftSupport}
end;
@@ -641,12 +646,12 @@ begin
Exit; //==>
{$IFDEF XftSupport}
- fnt := XftFontOpenName(gApplication.Handle, XDefaultScreen(gApplication.Handle), PChar('Sans-12'));
+ fnt := XftFontOpenName(GFApplication.Handle, XDefaultScreen(GFApplication.Handle), PChar('Sans-12'));
SetXftColor(FCurColor,fntColor);
s := u8(AText);
-// XftDrawString8(FXftDraw, fntColor, fnt, APosition.x, Aposition.y, PChar(AText),Length(AText));
- XftDrawString16(FXftDraw, fntColor, fnt, APosition.x, Aposition.y * 3, @s[1], Length16(s));
- XftFontClose(gApplication.Handle, fnt);
+ XftDrawString8(FXftDraw, fntColor, fnt, APosition.x, Aposition.y, PChar(AText),Length(AText));
+// XftDrawString16(FXftDraw, fntColor, fnt, APosition.x, Aposition.y * 3, @s[1], Length16(s));
+ XftFontClose(GFApplication.Handle, fnt);
{$ELSE}
XDrawString(GFApplication.Handle, Handle, GC, APosition.x,
APosition.y + FFontStruct^.ascent, PChar(AText), Length(AText));
@@ -1530,21 +1535,24 @@ begin
GFApplication.DirtyList.AddRect(Self, ARect);
end;
-
procedure TX11Window.PaintInvalidRegion;
begin
GFApplication.DirtyList.PaintQueueForWindow(Self);
end;
-
procedure TX11Window.CaptureMouse;
begin
- XGrabPointer(GFApplication.Handle, Handle, False, ButtonPressMask or
- ButtonReleaseMask or EnterWindowMask or LeaveWindowMask or
- PointerMotionMask, GrabModeAsync, GrabModeAsync, 0, 0, CurrentTime);
+ XGrabPointer(GFApplication.Handle, Handle,
+ True,
+ ButtonPressMask or ButtonReleaseMask or EnterWindowMask or LeaveWindowMask or PointerMotionMask,
+ GrabModeAsync,
+ GrabModeAsync,
+ 0,
+ 0,
+ CurrentTime
+ );
end;
-
procedure TX11Window.ReleaseMouse;
begin
XUngrabPointer(GFApplication.Handle, CurrentTime);
@@ -1615,7 +1623,7 @@ begin
end;
etMouseLeave:
begin
- if Assigned(OnMouseEnter) then OnMouseLeave(Self)
+ if Assigned(OnMouseLeave) then OnMouseLeave(Self)
else if Assigned(Parent) then Parent.ProcessEvent(AEvent);
end;
etMousePressed: