From 2d5991c4c67b9ead40df34cfdb73434231956116 Mon Sep 17 00:00:00 2001 From: graemeg Date: Sun, 27 May 2007 08:45:29 +0000 Subject: * Minor improvement in setting the window title under X11. * Thanks to Felipe for fixing the TFBitmap issue, the Base Style in the GUI can now use bitmaps under Linux as well. --- gfx/x11/gfx_x11.pas | 19 +++++++++++++++--- gui/fpguistyle.inc | 56 ----------------------------------------------------- 2 files changed, 16 insertions(+), 59 deletions(-) diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas index 868281b9..d10ed0fd 100644 --- a/gfx/x11/gfx_x11.pas +++ b/gfx/x11/gfx_x11.pas @@ -273,6 +273,8 @@ uses GELImage ,fpGFX ,fpUTF8Utils + ,Xatom + ,CTypes {,keysym ,libc , } ; resourcestring @@ -821,12 +823,12 @@ begin else raise EX11Error.CreateFmt(SWindowUnsupportedPixelFormat, [Attr.Depth]); end; - + if Attr.Depth >= 16 then begin - PixelFormat.RedMask := Visual^.red_mask; + PixelFormat.RedMask := Visual^.red_mask; PixelFormat.GreenMask := Visual^.green_mask; - PixelFormat.BlueMask := Visual^.blue_mask; + PixelFormat.BlueMask := Visual^.blue_mask; end; end; @@ -868,6 +870,7 @@ begin else FStride := AWidth * (FormatTypeBPPTable[APixelFormat.FormatType] shr 3); end; + GetMem(FData, FStride * Height); end; @@ -1689,8 +1692,18 @@ begin end; procedure TX11Window.SetTitle(const ATitle: String); +var + tp: TXTextProperty; begin + tp.value := PCUChar(ATitle); + tp.encoding := XA_WM_NAME; + tp.format := 8; + tp.nitems := UTF8Length(ATitle); + + XSetWMName(GFApplication.Handle, Handle, @tp); XStoreName(GFApplication.Handle, Handle, PChar(ATitle)); + XSetIconName(GFApplication.Handle, Handle, PChar(ATitle)); + XSetWMIconName(GFApplication.Handle, Handle, @tp); end; procedure TX11Window.DoSetCursor; diff --git a/gui/fpguistyle.inc b/gui/fpguistyle.inc index af04cfed..991c85b5 100644 --- a/gui/fpguistyle.inc +++ b/gui/fpguistyle.inc @@ -672,8 +672,6 @@ var Index, BtnY: Integer; r: TRect; begin - {$Note This is only while I fix the Palette issue under Linux/X11 } - {$IFDEF MSWINDOWS} with ARect do begin BtnY := Top + (Bottom - Top - 12) div 2; @@ -689,60 +687,6 @@ begin Rect(Index * 12, 0, (Index + 1) * 12, 12), Point(0, 0), Point(Left, BtnY)); end; - {$ELSE} - -// cl3DLight, cl3DHighlight, cl3DDkShadow, cl3DShadow - SetUIColor(Canvas, clLtGray); - r.Left := ARect.Left; - r.Top := ARect.Top + (ARect.Bottom - ARect.Top - 13) div 2; - r.Right := 13; - r.Bottom := r.Top + 13; - Canvas.DrawCircle(r); - - SetUIColor(Canvas, cl3DShadow); - InflateRect(r, -2, -2); - Canvas.DrawCircle(r); - - if cbIsEnabled in Flags then - SetUIColor(Canvas, cl3DDkShadow) - else - SetUIColor(Canvas, cl3DShadow); - InflateRect(r, 1, 1); - Canvas.DrawCircle(r); - - if cbIsEnabled in Flags then - begin - if cbIsChecked in Flags then - begin - SetUIColor(Canvas, clNavy); - InflateRect(r, -3, -3); - Canvas.DrawCircle(r); - InflateRect(r, -1, -1); - Canvas.FillRect(r); - InflateRect(r, 1, 1); - SetUIColor(Canvas, clSkyBlue); - InflateRect(r, -2, -2); - OffsetRect(r, -1, -1); - Canvas.FillRect(r); - end; - end - else - begin - if cbIsChecked in Flags then - begin - SetUIColor(Canvas, cl3DShadow); - InflateRect(r, -3, -3); - Canvas.DrawCircle(r); - InflateRect(r, -1, -1); - Canvas.FillRect(r); - InflateRect(r, 1, 1); - SetUIColor(Canvas, clLtGray); - InflateRect(r, -2, -2); - OffsetRect(r, -1, -1); - Canvas.FillRect(r); - end; - end; - {$ENDIF} if cbHasFocus in Flags then with LabelRect do -- cgit v1.2.3-70-g09d2