gtk intf: first try to debug caret bug

git-svn-id: trunk@15426 -
This commit is contained in:
mattias 2008-06-14 17:26:23 +00:00
parent daf9bb41ce
commit b713bcb5bb

View File

@ -90,7 +90,7 @@ type
X: Integer; X: Integer;
Y: Integer; Y: Integer;
Width: Integer; Width: Integer;
Height: Integer; Height: Integer;
Visible: Boolean; // Caret is on Visible: Boolean; // Caret is on
IsDrawn: Boolean; // Caret is visible at the moment IsDrawn: Boolean; // Caret is visible at the moment
Blinking: Boolean; // Caret should blink Blinking: Boolean; // Caret should blink
@ -168,6 +168,8 @@ function GTKAPIWidgetClient_FocusIn(AWidget: PGTKWidget;
Event: PGdkEventFocus): GTKEventResult; cdecl; forward; Event: PGdkEventFocus): GTKEventResult; cdecl; forward;
function GTKAPIWidgetClient_FocusOut(AWidget: PGTKWidget; function GTKAPIWidgetClient_FocusOut(AWidget: PGTKWidget;
Event: PGdkEventFocus): GTKEventResult; cdecl; forward; Event: PGdkEventFocus): GTKEventResult; cdecl; forward;
function GTKAPIWidgetClient_Expose(widget: PGtkWidget;
event: PGdkEventExpose): gboolean; cdecl; forward;
procedure GTKAPIWidgetClient_ClassInit(theClass: Pointer);cdecl; forward; procedure GTKAPIWidgetClient_ClassInit(theClass: Pointer);cdecl; forward;
{$ifdef gtk2} {$ifdef gtk2}
@ -284,6 +286,7 @@ begin
key_press_event := @GTKAPIWidgetClient_KeyPress; key_press_event := @GTKAPIWidgetClient_KeyPress;
focus_in_event := @GTKAPIWidgetClient_FocusIn; focus_in_event := @GTKAPIWidgetClient_FocusIn;
focus_out_event := @GTKAPIWidgetClient_FocusOut; focus_out_event := @GTKAPIWidgetClient_FocusOut;
expose_event := @GTKAPIWidgetClient_Expose;
end; end;
end; end;
@ -592,6 +595,17 @@ begin
Result := gtk_False; Result := gtk_False;
end; end;
function GTKAPIWidgetClient_Expose(widget: PGtkWidget; event: PGdkEventExpose): gboolean; cdecl;
//var
//Client: PGTKAPIWidgetClient;
begin
//DebugLn(['GTKAPIWidgetClient_Expose ',GTK_WIDGET_DOUBLE_BUFFERED(Widget)]);
{Client:=PGTKAPIWidgetClient(Widget);
if GTK_WIDGET_DOUBLE_BUFFERED(Widget) then
Client^.Caret.IsDrawn:=false;}
Result := gtk_False;
end;
procedure GTKAPIWidgetClient_HideCaret(Client: PGTKAPIWidgetClient; procedure GTKAPIWidgetClient_HideCaret(Client: PGTKAPIWidgetClient;
var OldVisible: boolean); var OldVisible: boolean);
begin begin
@ -658,13 +672,18 @@ begin
if (BackPixmap <> nil) if (BackPixmap <> nil)
and (Widget<>nil) and (Widget<>nil)
and (WidgetStyle<>nil) and (WidgetStyle<>nil)
then gdk_draw_pixmap( then begin
Widget^.Window, gdk_draw_pixmap(
WidgetStyle^.bg_gc[GTK_STATE_NORMAL], Widget^.Window,
BackPixmap, 0, 0, WidgetStyle^.bg_gc[GTK_STATE_NORMAL],
X, Y-1, // Y-1 for Delphi compatibility BackPixmap, 0, 0,
Width, Height X, Y-1, // Y-1 for Delphi compatibility
); Width, Height
);
{$IFDEF VerboseCaret}
DebugLn(['GTKAPIWidgetClient_DrawCaret Hide ',X,',',Y]);
{$ENDIF}
end;
IsDrawn := False; IsDrawn := False;
end end
else else
@ -690,14 +709,19 @@ begin
and (Widget<>nil) and (Widget<>nil)
and (WidgetStyle<>nil) and (WidgetStyle<>nil)
and (Width>0) and (Height>0) and (Width>0) and (Height>0)
then gdk_draw_pixmap( then begin
BackPixmap, {$IFDEF VerboseCaret}
WidgetStyle^.bg_gc[GTK_STATE_NORMAL], DebugLn(['GTKAPIWidgetClient_DrawCaret Store ',X,',',Y]);
Widget^.Window, {$ENDIF}
X, Y-1, // Y-1 for Delphi compatibility gdk_draw_pixmap(
0, 0, BackPixmap,
Width, Height WidgetStyle^.bg_gc[GTK_STATE_NORMAL],
); Widget^.Window,
X, Y-1, // Y-1 for Delphi compatibility
0, 0,
Width, Height
);
end;
// draw caret // draw caret
{$IFDEF VerboseCaret} {$IFDEF VerboseCaret}
@ -718,7 +742,7 @@ begin
//gdk_gc_get_values(ForeGroundGC,@ForeGroundGCValues); //gdk_gc_get_values(ForeGroundGC,@ForeGroundGCValues);
//OldGdkFunction:=ForeGroundGCValues.thefunction; //OldGdkFunction:=ForeGroundGCValues.thefunction;
{$IFDEF VerboseCaret} {$IFDEF VerboseCaret}
DebugLn('GTKAPIWidgetClient_DrawCaret ',DbgS(Client),' Real Drawing Caret '); DebugLn('GTKAPIWidgetClient_DrawCaret ',DbgS(Client),' Real Drawing Caret ',X,',',Y);
{$ENDIF} {$ENDIF}
gdk_gc_set_function(ForeGroundGC,GDK_invert); gdk_gc_set_function(ForeGroundGC,GDK_invert);
try try