diff --git a/lcl/include/customform.inc b/lcl/include/customform.inc index 22e3715038..ed6bb6e27b 100644 --- a/lcl/include/customform.inc +++ b/lcl/include/customform.inc @@ -702,10 +702,10 @@ begin begin OldState := FWindowState; case (Message.SizeType and not SIZE_SourceIsInterface) of - SIZENORMAL: + SIZE_RESTORED: if Showing then FWindowState := wsNormal; - SIZEICONIC: + SIZE_MINIMIZED: begin if Showing then FWindowState := wsMinimized; @@ -713,9 +713,12 @@ begin and (Application.MainForm = Self) then Application.Minimize; end; - SIZEFULLSCREEN: + SIZE_MAXIMIZED: if Showing then FWindowState := wsMaximized; + SIZE_FULLSCREEN: + if Showing then + FWindowState := wsFullScreen; end; if OldState <> FWindowState then begin @@ -731,7 +734,7 @@ begin inherited WMSize(Message); - if (Message.SizeType and Size_Restored) > 0 then + if (Message.SizeType and SIZE_RESTORED) > 0 then begin FRestoredLeft := Left; FRestoredTop := Top; diff --git a/lcl/interfaces/carbon/carbonprivatewindow.inc b/lcl/interfaces/carbon/carbonprivatewindow.inc index 30e0e5f8a2..6f7fa8268f 100644 --- a/lcl/interfaces/carbon/carbonprivatewindow.inc +++ b/lcl/interfaces/carbon/carbonprivatewindow.inc @@ -1042,13 +1042,13 @@ begin Kind := -1; case EventKind of - kEventWindowCollapsed: Kind := SIZEICONIC; + kEventWindowCollapsed: Kind := SIZE_MINIMIZED; kEventWindowExpanded, kEventWindowZoomed: begin if IsWindowInStandardState(TCarbonWindow(AWidget).fWindowRef, nil, nil) then - Kind := SIZEFULLSCREEN + Kind := SIZE_MAXIMIZED else - Kind := SIZENORMAL; + Kind := SIZE_RESTORED; end; else DebugLn('CarbonWindow_ShowWindow invalid event kind: ' + DbgS(EventKind)); diff --git a/lcl/interfaces/cocoa/cocoaprivate.pp b/lcl/interfaces/cocoa/cocoaprivate.pp index cf54fc5389..57f4fec14b 100644 --- a/lcl/interfaces/cocoa/cocoaprivate.pp +++ b/lcl/interfaces/cocoa/cocoaprivate.pp @@ -1003,7 +1003,7 @@ end; function LCLObjectExtension.lclWindowState: Integer; begin - Result := SIZENORMAL; + Result := SIZE_RESTORED; end; procedure LCLObjectExtension.lclInvalidateRect(const r: TRect); @@ -1300,13 +1300,14 @@ end; function LCLWindowExtension.lclWindowState: Integer; begin + // todo: check fullscreen using NSFullScreenWindowMask if isMiniaturized then - Result := SIZEICONIC + Result := SIZE_MINIMIZED else if isZoomed then - Result := SIZEFULLSCREEN + Result := SIZE_MAXIMIZED else - Result := SIZENORMAL; + Result := SIZE_RESTORED; end; procedure LCLWindowExtension.lclInvalidateRect(const r: TRect); diff --git a/lcl/interfaces/fpgui/fpguiwsprivate.pp b/lcl/interfaces/fpgui/fpguiwsprivate.pp index 67084def03..935958b807 100644 --- a/lcl/interfaces/fpgui/fpguiwsprivate.pp +++ b/lcl/interfaces/fpgui/fpguiwsprivate.pp @@ -15,7 +15,7 @@ * * * This file is part of the Lazarus Component Library (LCL) * * * - * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * * for details about the copyright. * * * * This program is distributed in the hope that it will be useful, * @@ -535,7 +535,7 @@ end; procedure TFPGUIPrivateWidget.ResizeHandler(Sender: TObject); begin - LCLSendSizeMsg(FLCLObject,Widget.Width,Widget.Height,SIZENORMAL,true); + LCLSendSizeMsg(FLCLObject,Widget.Width,Widget.Height,SIZE_RESTORED,true); end; procedure TFPGUIPrivateWidget.MsgDeactivate(var fpgmsg: TfpgMessageRec); @@ -583,7 +583,7 @@ end; procedure TFPGUIPrivateWidget.MsgResize(var fpgmsg: TfpgMessageRec); 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; procedure TFPGUIPrivateWidget.MsgMove(var fpgmsg: TfpgMessageRec); @@ -773,7 +773,7 @@ end; procedure TFPGUIPrivateWidget.SetSize(AWidth, AHeight: LongInt); begin FWidget.SetPosition(FWidget.Left, FWidget.Top, AWidth, AHeight); - LCLSendSizeMsg(FLCLObject,AWidth,AHeight,SIZENORMAL,false); + LCLSendSizeMsg(FLCLObject,AWidth,AHeight,SIZE_RESTORED,false); end; procedure TFPGUIPrivateWidget.SetPosition(AX, AY: Integer); diff --git a/lcl/interfaces/gtk2/gtk2callback.inc b/lcl/interfaces/gtk2/gtk2callback.inc index 27b74b48f9..0df6911dee 100644 --- a/lcl/interfaces/gtk2/gtk2callback.inc +++ b/lcl/interfaces/gtk2/gtk2callback.inc @@ -1146,27 +1146,28 @@ begin end; end; {$ENDIF} - SizeMsg.SizeType := SIZEICONIC; + SizeMsg.SizeType := SIZE_MINIMIZED; end else if (GDK_WINDOW_STATE_MAXIMIZED and state^.new_window_state)>0 then begin // 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; - SizeMsg.SizeType := SIZEFULLSCREEN; + SizeMsg.SizeType := SIZE_MAXIMIZED; end else - SizeMsg.SizeType := SIZENORMAL; + SizeMsg.SizeType := SIZE_RESTORED; if (TheForm = Application.MainForm) and - (SizeMsg.SizeType <> SIZEICONIC) and + (SizeMsg.SizeType <> SIZE_MINIMIZED) and (TheForm.WindowState = wsMinimized) then Application.IntfAppRestore; // don't bother the LCL if nothing changed case SizeMsg.SizeType of - SIZENORMAL: if TheForm.WindowState=wsNormal then exit; - SIZEICONIC: if TheForm.WindowState=wsMinimized then exit; - SIZEFULLSCREEN: if TheForm.WindowState=wsMaximized then exit; + SIZE_RESTORED: if TheForm.WindowState=wsNormal then exit; + SIZE_MINIMIZED: if TheForm.WindowState=wsMinimized then exit; + SIZE_MAXIMIZED: if TheForm.WindowState=wsMaximized then exit; + SIZE_FULLSCREEN: if TheForm.WindowState=wsFullScreen then exit; end; with SizeMsg do diff --git a/lcl/interfaces/gtk2/gtk2proc.inc b/lcl/interfaces/gtk2/gtk2proc.inc index 64a8fc8469..d50d6fc9de 100644 --- a/lcl/interfaces/gtk2/gtk2proc.inc +++ b/lcl/interfaces/gtk2/gtk2proc.inc @@ -6484,12 +6484,13 @@ begin Result := 0; Msg := LM_SIZE; 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 case TCustomForm(LCLControl).WindowState of - wsNormal: SizeType := SIZENORMAL; - wsMinimized: SizeType := SIZEICONIC; - wsMaximized: SizeType := SIZEFULLSCREEN; + wsNormal: SizeType := SIZE_RESTORED; + wsMinimized: SizeType := SIZE_MINIMIZED; + wsMaximized: SizeType := SIZE_MAXIMIZED; + wsFullScreen: SizeType := SIZE_FULLSCREEN; end; end else diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index d9fe9d650d..109fa9ab77 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -3723,11 +3723,11 @@ begin Msg.Msg := LM_SIZE; case getWindowState of - QtWindowMinimized: Msg.SizeType := SIZEICONIC; - QtWindowMaximized: Msg.SizeType := SIZEFULLSCREEN; - QtWindowFullScreen: Msg.SizeType := SIZEFULLSCREEN; + QtWindowMinimized: Msg.SizeType := SIZE_MINIMIZED; + QtWindowMaximized: Msg.SizeType := SIZE_MAXIMIZED; + QtWindowFullScreen: Msg.SizeType := SIZE_FULLSCREEN; else - Msg.SizeType := SIZENORMAL; + Msg.SizeType := SIZE_RESTORED; end; Msg.SizeType := Msg.SizeType or Size_SourceIsInterface; @@ -6351,14 +6351,16 @@ begin FillChar(Msg, SizeOf(Msg), #0); Msg.Msg := LM_SIZE; - Msg.SizeType := SIZENORMAL; + Msg.SizeType := SIZE_RESTORED; if getWindowState and QtWindowMinimized <> 0 then - Msg.SizeType := SIZEICONIC + Msg.SizeType := SIZE_MINIMIZED else - if (getWindowState and QtWindowFullScreen <> 0) or - (getWindowState and QtWindowMaximized <> 0) then - Msg.SizeType := SIZEFULLSCREEN; + if (getWindowState and QtWindowFullScreen <> 0) then + Msg.SizeType := SIZE_FULLSCREEN + else + if (getWindowState and QtWindowMaximized <> 0) then + Msg.SizeType := SIZE_MAXIMIZED; Msg.SizeType := Msg.SizeType or Size_SourceIsInterface; diff --git a/lcl/lclmessageglue.pas b/lcl/lclmessageglue.pas index 60198b9321..1037d4927b 100644 --- a/lcl/lclmessageglue.pas +++ b/lcl/lclmessageglue.pas @@ -250,8 +250,7 @@ end; * * * Target : The Control that will recieve the message LM_SIZE * * Width, Height : The new Width and Height for the control * - * SizeType : SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN, SIZEZOOMSHOW or * - * SIZEZOOMHIDE. (In LCLType) * + * SizeType : SIZE_RESTORED, SIZE_MINIMIZED, SIZE_MAXIMIZED,... * * FromInterface : True if this message was sent from the widgetset to notify * * the LCL of a change. False to make the widgetset change * * the size of the control. Default = True * @@ -267,7 +266,6 @@ begin Mess.Msg := LM_SIZE; Mess.Width := Width; Mess.Height := Height; - //SIZENORMAL, SIZEICONIC, SIZEFULLSCREEN, SIZEZOOMSHOW, SIZEZOOMHIDE. Mess.SizeType := SizeType; if FromInterface then Mess.SizeType := Mess.SizeType or Size_SourceIsInterface; diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index a75e5b48ea..b696c634d2 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -864,18 +864,19 @@ const SWP_SourceIsInterface = $10000; // this flag can be combined with the above { WMSIZE message constants} - Size_Restored = 0; // the default - Size_Minimized = 1; - Size_Maximized = 2; - Size_MaxShow = 3; - Size_MaxHide = 4; + SIZE_RESTORED = 0; // the default + SIZE_MINIMIZED = 1; + SIZE_MAXIMIZED = 2; + SIZE_MAXSHOW = 3; + SIZE_MAXHIDE = 4; + SIZE_FULLSCREEN = 16; // non-winapi value to support wsFullScreen state Size_SourceIsInterface = 128; // this flag can be combined with the above - SIZENORMAL = Size_Restored; - SIZEICONIC = Size_Minimized; - SIZEFULLSCREEN = Size_Maximized; - SIZEZOOMSHOW = Size_MaxShow; - SIZEZOOMHIDE = Size_MaxHide; + SIZENORMAL = SIZE_RESTORED; + SIZEICONIC = SIZE_MINIMIZED; + SIZEFULLSCREEN = SIZE_MAXIMIZED; + SIZEZOOMSHOW = SIZE_MAXSHOW; + SIZEZOOMHIDE = SIZE_MAXHIDE; { WMMove Message Constants } Move_Default = 0;