- replace old SIZENORMAL, SIZEICONINC, ... constants with SIZE_RESTORED, SIZE_MINIMIZED
  - add new SIZE_FULLSCREEN constant to support wsFullScreen state

git-svn-id: trunk@36432 -
This commit is contained in:
paul 2012-03-30 01:05:10 +00:00
parent b356839d80
commit d6e2a77af5
9 changed files with 55 additions and 48 deletions

View File

@ -702,10 +702,10 @@ begin
begin begin
OldState := FWindowState; OldState := FWindowState;
case (Message.SizeType and not SIZE_SourceIsInterface) of case (Message.SizeType and not SIZE_SourceIsInterface) of
SIZENORMAL: SIZE_RESTORED:
if Showing then if Showing then
FWindowState := wsNormal; FWindowState := wsNormal;
SIZEICONIC: SIZE_MINIMIZED:
begin begin
if Showing then if Showing then
FWindowState := wsMinimized; FWindowState := wsMinimized;
@ -713,9 +713,12 @@ begin
and (Application.MainForm = Self) then and (Application.MainForm = Self) then
Application.Minimize; Application.Minimize;
end; end;
SIZEFULLSCREEN: SIZE_MAXIMIZED:
if Showing then if Showing then
FWindowState := wsMaximized; FWindowState := wsMaximized;
SIZE_FULLSCREEN:
if Showing then
FWindowState := wsFullScreen;
end; end;
if OldState <> FWindowState then if OldState <> FWindowState then
begin begin
@ -731,7 +734,7 @@ begin
inherited WMSize(Message); inherited WMSize(Message);
if (Message.SizeType and Size_Restored) > 0 then if (Message.SizeType and SIZE_RESTORED) > 0 then
begin begin
FRestoredLeft := Left; FRestoredLeft := Left;
FRestoredTop := Top; FRestoredTop := Top;

View File

@ -1042,13 +1042,13 @@ begin
Kind := -1; Kind := -1;
case EventKind of case EventKind of
kEventWindowCollapsed: Kind := SIZEICONIC; kEventWindowCollapsed: Kind := SIZE_MINIMIZED;
kEventWindowExpanded, kEventWindowZoomed: kEventWindowExpanded, kEventWindowZoomed:
begin begin
if IsWindowInStandardState(TCarbonWindow(AWidget).fWindowRef, nil, nil) then if IsWindowInStandardState(TCarbonWindow(AWidget).fWindowRef, nil, nil) then
Kind := SIZEFULLSCREEN Kind := SIZE_MAXIMIZED
else else
Kind := SIZENORMAL; Kind := SIZE_RESTORED;
end; end;
else else
DebugLn('CarbonWindow_ShowWindow invalid event kind: ' + DbgS(EventKind)); DebugLn('CarbonWindow_ShowWindow invalid event kind: ' + DbgS(EventKind));

View File

@ -1003,7 +1003,7 @@ end;
function LCLObjectExtension.lclWindowState: Integer; function LCLObjectExtension.lclWindowState: Integer;
begin begin
Result := SIZENORMAL; Result := SIZE_RESTORED;
end; end;
procedure LCLObjectExtension.lclInvalidateRect(const r: TRect); procedure LCLObjectExtension.lclInvalidateRect(const r: TRect);
@ -1300,13 +1300,14 @@ end;
function LCLWindowExtension.lclWindowState: Integer; function LCLWindowExtension.lclWindowState: Integer;
begin begin
// todo: check fullscreen using NSFullScreenWindowMask
if isMiniaturized then if isMiniaturized then
Result := SIZEICONIC Result := SIZE_MINIMIZED
else else
if isZoomed then if isZoomed then
Result := SIZEFULLSCREEN Result := SIZE_MAXIMIZED
else else
Result := SIZENORMAL; Result := SIZE_RESTORED;
end; end;
procedure LCLWindowExtension.lclInvalidateRect(const r: TRect); procedure LCLWindowExtension.lclInvalidateRect(const r: TRect);

View File

@ -535,7 +535,7 @@ end;
procedure TFPGUIPrivateWidget.ResizeHandler(Sender: TObject); procedure TFPGUIPrivateWidget.ResizeHandler(Sender: TObject);
begin begin
LCLSendSizeMsg(FLCLObject,Widget.Width,Widget.Height,SIZENORMAL,true); LCLSendSizeMsg(FLCLObject,Widget.Width,Widget.Height,SIZE_RESTORED,true);
end; end;
procedure TFPGUIPrivateWidget.MsgDeactivate(var fpgmsg: TfpgMessageRec); procedure TFPGUIPrivateWidget.MsgDeactivate(var fpgmsg: TfpgMessageRec);
@ -583,7 +583,7 @@ end;
procedure TFPGUIPrivateWidget.MsgResize(var fpgmsg: TfpgMessageRec); procedure TFPGUIPrivateWidget.MsgResize(var fpgmsg: TfpgMessageRec);
begin begin
LCLSendSizeMsg(LCLObject, fpgmsg.Params.rect.Width,fpgmsg.Params.rect.Height, SIZENORMAL, false); LCLSendSizeMsg(LCLObject, fpgmsg.Params.rect.Width,fpgmsg.Params.rect.Height, SIZE_RESTORED, false);
end; end;
procedure TFPGUIPrivateWidget.MsgMove(var fpgmsg: TfpgMessageRec); procedure TFPGUIPrivateWidget.MsgMove(var fpgmsg: TfpgMessageRec);
@ -773,7 +773,7 @@ end;
procedure TFPGUIPrivateWidget.SetSize(AWidth, AHeight: LongInt); procedure TFPGUIPrivateWidget.SetSize(AWidth, AHeight: LongInt);
begin begin
FWidget.SetPosition(FWidget.Left, FWidget.Top, AWidth, AHeight); FWidget.SetPosition(FWidget.Left, FWidget.Top, AWidth, AHeight);
LCLSendSizeMsg(FLCLObject,AWidth,AHeight,SIZENORMAL,false); LCLSendSizeMsg(FLCLObject,AWidth,AHeight,SIZE_RESTORED,false);
end; end;
procedure TFPGUIPrivateWidget.SetPosition(AX, AY: Integer); procedure TFPGUIPrivateWidget.SetPosition(AX, AY: Integer);

View File

@ -1146,27 +1146,28 @@ begin
end; end;
end; end;
{$ENDIF} {$ENDIF}
SizeMsg.SizeType := SIZEICONIC; SizeMsg.SizeType := SIZE_MINIMIZED;
end end
else if (GDK_WINDOW_STATE_MAXIMIZED and state^.new_window_state)>0 then else if (GDK_WINDOW_STATE_MAXIMIZED and state^.new_window_state)>0 then
begin begin
// it can be both maximized + iconified and just loose iconified state // it can be both maximized + iconified and just loose iconified state
if (state^.changed_mask and (GDK_WINDOW_STATE_MAXIMIZED or GDK_WINDOW_STATE_ICONIFIED)) = 0 then Exit; if (state^.changed_mask and (GDK_WINDOW_STATE_MAXIMIZED or GDK_WINDOW_STATE_ICONIFIED)) = 0 then Exit;
SizeMsg.SizeType := SIZEFULLSCREEN; SizeMsg.SizeType := SIZE_MAXIMIZED;
end end
else else
SizeMsg.SizeType := SIZENORMAL; SizeMsg.SizeType := SIZE_RESTORED;
if (TheForm = Application.MainForm) and if (TheForm = Application.MainForm) and
(SizeMsg.SizeType <> SIZEICONIC) and (SizeMsg.SizeType <> SIZE_MINIMIZED) and
(TheForm.WindowState = wsMinimized) then (TheForm.WindowState = wsMinimized) then
Application.IntfAppRestore; Application.IntfAppRestore;
// don't bother the LCL if nothing changed // don't bother the LCL if nothing changed
case SizeMsg.SizeType of case SizeMsg.SizeType of
SIZENORMAL: if TheForm.WindowState=wsNormal then exit; SIZE_RESTORED: if TheForm.WindowState=wsNormal then exit;
SIZEICONIC: if TheForm.WindowState=wsMinimized then exit; SIZE_MINIMIZED: if TheForm.WindowState=wsMinimized then exit;
SIZEFULLSCREEN: if TheForm.WindowState=wsMaximized then exit; SIZE_MAXIMIZED: if TheForm.WindowState=wsMaximized then exit;
SIZE_FULLSCREEN: if TheForm.WindowState=wsFullScreen then exit;
end; end;
with SizeMsg do with SizeMsg do

View File

@ -6484,12 +6484,13 @@ begin
Result := 0; Result := 0;
Msg := LM_SIZE; Msg := LM_SIZE;
if LCLControl is TCustomForm then begin if LCLControl is TCustomForm then begin
// if the LCL gets an event without a State it resets it to SIZENORMAL // if the LCL gets an event without a State it resets it to SIZE_RESTORED
// so we send it the state it already is // so we send it the state it already is
case TCustomForm(LCLControl).WindowState of case TCustomForm(LCLControl).WindowState of
wsNormal: SizeType := SIZENORMAL; wsNormal: SizeType := SIZE_RESTORED;
wsMinimized: SizeType := SIZEICONIC; wsMinimized: SizeType := SIZE_MINIMIZED;
wsMaximized: SizeType := SIZEFULLSCREEN; wsMaximized: SizeType := SIZE_MAXIMIZED;
wsFullScreen: SizeType := SIZE_FULLSCREEN;
end; end;
end end
else else

View File

@ -3723,11 +3723,11 @@ begin
Msg.Msg := LM_SIZE; Msg.Msg := LM_SIZE;
case getWindowState of case getWindowState of
QtWindowMinimized: Msg.SizeType := SIZEICONIC; QtWindowMinimized: Msg.SizeType := SIZE_MINIMIZED;
QtWindowMaximized: Msg.SizeType := SIZEFULLSCREEN; QtWindowMaximized: Msg.SizeType := SIZE_MAXIMIZED;
QtWindowFullScreen: Msg.SizeType := SIZEFULLSCREEN; QtWindowFullScreen: Msg.SizeType := SIZE_FULLSCREEN;
else else
Msg.SizeType := SIZENORMAL; Msg.SizeType := SIZE_RESTORED;
end; end;
Msg.SizeType := Msg.SizeType or Size_SourceIsInterface; Msg.SizeType := Msg.SizeType or Size_SourceIsInterface;
@ -6351,14 +6351,16 @@ begin
FillChar(Msg, SizeOf(Msg), #0); FillChar(Msg, SizeOf(Msg), #0);
Msg.Msg := LM_SIZE; Msg.Msg := LM_SIZE;
Msg.SizeType := SIZENORMAL; Msg.SizeType := SIZE_RESTORED;
if getWindowState and QtWindowMinimized <> 0 then if getWindowState and QtWindowMinimized <> 0 then
Msg.SizeType := SIZEICONIC Msg.SizeType := SIZE_MINIMIZED
else else
if (getWindowState and QtWindowFullScreen <> 0) or if (getWindowState and QtWindowFullScreen <> 0) then
(getWindowState and QtWindowMaximized <> 0) then Msg.SizeType := SIZE_FULLSCREEN
Msg.SizeType := SIZEFULLSCREEN; else
if (getWindowState and QtWindowMaximized <> 0) then
Msg.SizeType := SIZE_MAXIMIZED;
Msg.SizeType := Msg.SizeType or Size_SourceIsInterface; Msg.SizeType := Msg.SizeType or Size_SourceIsInterface;

View File

@ -250,8 +250,7 @@ end;
* * * *
* Target : The Control that will recieve the message LM_SIZE * * Target : The Control that will recieve the message LM_SIZE *
* Width, Height : The new Width and Height for the control * * Width, Height : The new Width and Height for the control *
* SizeType : SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN, SIZEZOOMSHOW or * * SizeType : SIZE_RESTORED, SIZE_MINIMIZED, SIZE_MAXIMIZED,... *
* SIZEZOOMHIDE. (In LCLType) *
* FromInterface : True if this message was sent from the widgetset to notify * * FromInterface : True if this message was sent from the widgetset to notify *
* the LCL of a change. False to make the widgetset change * * the LCL of a change. False to make the widgetset change *
* the size of the control. Default = True * * the size of the control. Default = True *
@ -267,7 +266,6 @@ begin
Mess.Msg := LM_SIZE; Mess.Msg := LM_SIZE;
Mess.Width := Width; Mess.Width := Width;
Mess.Height := Height; Mess.Height := Height;
//SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN, SIZEZOOMSHOW, SIZEZOOMHIDE.
Mess.SizeType := SizeType; Mess.SizeType := SizeType;
if FromInterface then if FromInterface then
Mess.SizeType := Mess.SizeType or Size_SourceIsInterface; Mess.SizeType := Mess.SizeType or Size_SourceIsInterface;

View File

@ -864,18 +864,19 @@ const
SWP_SourceIsInterface = $10000; // this flag can be combined with the above SWP_SourceIsInterface = $10000; // this flag can be combined with the above
{ WMSIZE message constants} { WMSIZE message constants}
Size_Restored = 0; // the default SIZE_RESTORED = 0; // the default
Size_Minimized = 1; SIZE_MINIMIZED = 1;
Size_Maximized = 2; SIZE_MAXIMIZED = 2;
Size_MaxShow = 3; SIZE_MAXSHOW = 3;
Size_MaxHide = 4; SIZE_MAXHIDE = 4;
SIZE_FULLSCREEN = 16; // non-winapi value to support wsFullScreen state
Size_SourceIsInterface = 128; // this flag can be combined with the above Size_SourceIsInterface = 128; // this flag can be combined with the above
SIZENORMAL = Size_Restored; SIZENORMAL = SIZE_RESTORED;
SIZEICONIC = Size_Minimized; SIZEICONIC = SIZE_MINIMIZED;
SIZEFULLSCREEN = Size_Maximized; SIZEFULLSCREEN = SIZE_MAXIMIZED;
SIZEZOOMSHOW = Size_MaxShow; SIZEZOOMSHOW = SIZE_MAXSHOW;
SIZEZOOMHIDE = Size_MaxHide; SIZEZOOMHIDE = SIZE_MAXHIDE;
{ WMMove Message Constants } { WMMove Message Constants }
Move_Default = 0; Move_Default = 0;