gtk intf: made eventbox of client areas visible. Otherwise it eats some mouse events

git-svn-id: trunk@14069 -
This commit is contained in:
mattias 2008-02-10 13:57:46 +00:00
parent 6955671ea9
commit 763e629893
6 changed files with 27 additions and 10 deletions

View File

@ -3475,9 +3475,9 @@ end;
procedure TCustomGrid.WndProc(var TheMessage: TLMessage);
begin
{$ifdef GridTraceMsg}
TransMsg('GRID: ', TheMessage);
{$endif}
{$ifdef GridTraceMsg}
TransMsg('GRID: ', TheMessage);
{$endif}
case TheMessage.Msg of
LM_HSCROLL, LM_VSCROLL:
if csDesigning in ComponentState then

View File

@ -32,8 +32,8 @@
{off $DEFINE CHECK_POSITION}
{$IFDEF CHECK_POSITION}
const CheckPostionClassName = 'xxTPage';
const CheckPostionName = 'Edit2';
const CheckPostionParentName = 'EnvVarsPage';
const CheckPostionName = 'ComponentNotebook';
const CheckPostionParentName = 'xxxEnvVarsPage';
function CheckPosition(AControl: TControl): boolean;
begin

View File

@ -230,6 +230,7 @@ var
MainWidget: PGtkWidget;
begin
Result := CallBackDefaultReturn;
//DebugLn(['gtkRealizeAfterCB ',GetWidgetDebugReport(Widget)]);
if Data=nil then ;
{$IFDEF EventTrace}
@ -258,6 +259,7 @@ begin
//if TheWinControl<>nil then DbgOut(' ',TheWinControl.Name,':',TheWinControl.ClassName,' ',DbgS(TheWinControl.Handle));
//DebugLn(' Widget=',DbgS(Widget),' Fixed=',DbgS(GetFixedWidget(Widget)),' Main=',DbgS(GetMainWidget(Widget)));
if (TheWinControl<>nil) then begin
//DebugLn(['gtkRealizeAfterCB ',GetWidgetDebugReport(Widget)]);
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
NewEventMask:=gdk_window_get_events(GetControlWindow(Widget))
@ -268,7 +270,8 @@ begin
gdk_window_set_events(GetControlWindow(Widget),NewEventMask);
if (ClientWidget<>nil) and (GetControlWindow(ClientWidget)<>nil)
and (ClientWidget^.Window<>Widget^.Window) then begin
and (GetControlWindow(ClientWidget)<>GetControlWindow(Widget)) then begin
//DebugLn(['gtkRealizeAfterCB ClientWindow<>Window']);
NewEventMask:=gdk_window_get_events(GetControlWindow(ClientWidget))
or WinWidgetInfo^.EventMask;
{$IFNDEF Gtk1}

View File

@ -3780,7 +3780,16 @@ begin
{$else}
// Fixed w/o GdkWindow
Result := gtk_event_box_new;
gtk_event_box_set_visible_window(PGtkEventBox(Result), False);
{ MG: Normally the event box should be made invisible as suggested
here: http://library.gnome.org/devel/gtk/stable/GtkEventBox.html#gtk-event-box-set-visible-window
But is has a sideeffect:
Sometimes the mouse events for gtk widgets without window don't get any
mouse events any longer.
For example: Add a PageControl (Page3, Page4) into a PageControl (Page1,Page2).
Start program. Click on Page2, which hides the inner PageControl. Then
click to return to Page1. Now the inner PageControl does no longer
receive mouse events and so you can not switch between Page3 and Page4.}
// MG: disabled: gtk_event_box_set_visible_window(PGtkEventBox(Result), False);
TempWidget := CreateFixedClientWidget(False);
{$ifend}
@ -3793,6 +3802,10 @@ begin
end;
SetFixedWidget(Result, TempWidget);
SetMainWidget(Result, TempWidget);
// MG: should fix the invisible event box, but does not:
// gtk_widget_add_events (PGtkWidget(Result), GDK_BUTTON_PRESS_MASK);
gtk_widget_show(Result);
end;

View File

@ -512,7 +512,7 @@ begin
// ToDo: find out how to create a fully working hidden Notebook style widget
if (NBWidget=nil) then begin
Result:=inherited GetNotebookMinTabHeight(AWinControl);
Result:=TWSCustomNotebook.GetNotebookMinTabHeight(AWinControl);
exit;
end;
debugln('TGtkWSCustomNotebook.GetNotebookMinTabHeight NBWidget: ',GetWidgetDebugReport(NBWidget),
@ -546,7 +546,7 @@ end;
class function TGtkWSCustomNotebook.GetNotebookMinTabWidth(
const AWinControl: TWinControl): integer;
begin
Result:=inherited GetNotebookMinTabWidth(AWinControl);
Result:=TWSCustomNotebook.GetNotebookMinTabWidth(AWinControl);
end;
class function TGtkWSCustomNotebook.GetTabIndexAtPos(

View File

@ -56,7 +56,8 @@ type
private
protected
public
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override;
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): HWND; override;
class function GetDefaultClientRect(const AWinControl: TWinControl;
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
): boolean; override;