gtk2 intf: disabled SIZEICONIC messages, because the gtk2 sends them too, when user switches to another desktop, and then the LCL hides the whole application

git-svn-id: trunk@9524 -
This commit is contained in:
mattias 2006-06-28 23:36:52 +00:00
parent 3c0b2f09e2
commit fb6dfb5499
7 changed files with 18 additions and 9 deletions

View File

@ -1004,8 +1004,7 @@ end;
{$IFDEF Gtk2}
function GTKWindowStateEventCB(widget: PGtkWidget;
state: PGdkEventWindowState;
data: gpointer): gboolean; cdecl;
state: PGdkEventWindowState; data: gpointer): gboolean; cdecl;
var
TheForm: TCustomForm;
SizeMsg: TLMSize;
@ -1018,6 +1017,7 @@ begin
if TObject(Data) is TCustomForm then begin
TheForm := TCustomForm(Data);
DebugLn(['GTKWindowStateEventCB ',DbgSName(TheForm),' new_window_state=',state^.new_window_state,' changed_mask=',state^.changed_mask]);
if TheForm.Parent = nil then begin (* toplevel window, just as a sanity check *)
if GTK_WIDGET_REALIZED(Widget) then begin
// send a WMSize Message (see TCustomForm.WMSize)
@ -1025,9 +1025,13 @@ begin
if GtkWidth<0 then GtkWidth:=0;
GtkHeight:=Widget^.Allocation.Height;
if GtkHeight<0 then GtkHeight:=0;
//debugln('GTKWindowStateEventCB ',DbgSName(TObject(Data)),' ',dbgs(state^.new_window_state));
debugln('GTKWindowStateEventCB ',DbgSName(TObject(Data)),' ',dbgs(state^.new_window_state),' ',WidgetFlagsToString(Widget));
if (GDK_WINDOW_STATE_ICONIFIED and state^.new_window_state)>0 then
SizeMsg.SizeType:=SIZEICONIC
// the window is iconified, or the user switched to another desktop
// TODO: find out which one happened.
// The LCL interprets SIZEICONIC as minimizing by the user
// and thus minimizes the whole application.
SizeMsg.SizeType:=SIZENORMAL //SIZEICONIC
else if (GDK_WINDOW_STATE_MAXIMIZED and state^.new_window_state)>0 then
SizeMsg.SizeType:=SIZEFULLSCREEN
else

View File

@ -4965,8 +4965,8 @@ begin
Result := gtk_window_new(WindowType);
{$IFDEF Gtk2}
g_signal_connect(GTK_OBJECT(Result), 'window-state-event',
gtk_signal_func(@GTKWindowStateEventCB),
ACustomForm);
gtk_signal_func(@GTKWindowStateEventCB),
ACustomForm);
{$ENDIF}
gtk_window_set_policy(GTK_WINDOW(Result), FormResizableMap[ABorderStyle],

View File

@ -158,7 +158,7 @@ function GTKWindowStateEventCB(widget: PGtkWidget;
data: gpointer): gboolean; cdecl;
{$ENDIF}
{$IfNdef GTK2}
{$Ifdef GTK1}
function gtkDrawAfter(Widget: PGtkWidget; area: PGDKRectangle;
data: gPointer): GBoolean; cdecl;
{$EndIf}

View File

@ -16,7 +16,6 @@
</General>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
@ -41,6 +40,9 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<LCLWidgetType Value="gtk2"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>

View File

@ -159,6 +159,7 @@ end;
procedure TForm1.Form1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
exit;
debugln('TForm1.Form1MouseMove ',DbgSName(Sender),
' X=',dbgs(X),' Y=',dbgs(Y),' Shift=',dbgs(Shift));
end;

View File

@ -40,6 +40,9 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<LCLWidgetType Value="gtk2"/>
</SearchPaths>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>

View File

@ -256,7 +256,6 @@ begin
OnUTF8KeyPress:=@FormUTF8KeyPress;
inherited Create(TheOwner);
DebugLn(['TForm1And2.Create AAA ',DbgSName(Form1),' ',DbgSName(Form2)]);
if Self=Form1 then
Name:='Form1'
else