diff --git a/lcl/interfaces/gtk3/gtk3object.inc b/lcl/interfaces/gtk3/gtk3object.inc index 3c15d858cf..2fa57ade13 100644 --- a/lcl/interfaces/gtk3/gtk3object.inc +++ b/lcl/interfaces/gtk3/gtk3object.inc @@ -355,7 +355,6 @@ begin gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), PGtkStyleProvider(cssProvider), GTK_STYLE_PROVIDER_PRIORITY_USER); - end; destructor TGtk3WidgetSet.Destroy; @@ -504,21 +503,55 @@ begin gtk_main_quit; end; + procedure TGtk3WidgetSet.AppMinimize; +var + i: Integer; + AForm: TCustomForm; + W: TGtk3Widget; begin - DebugLn('TGtk3WidgetSet.AppMinimize missing'); + if Screen=nil then exit; + for i:= 0 to Screen.CustomFormZOrderCount-1 do + begin + AForm := Screen.CustomFormsZOrdered[i]; + if (AForm.Parent=nil) and AForm.HandleAllocated and + (TGtk3Widget(AForm.Handle).Visible) and + not (AForm.FormStyle in [fsMDIChild, fsSplash]) and + not (AForm.BorderStyle in [bsNone]) then + begin + W := TGtk3Widget(AForm.Handle); + PGtkWindow(W.Widget)^.iconify; + end; + end; end; + procedure TGtk3WidgetSet.AppRestore; +var + i: Integer; + AForm: TCustomForm; begin - DebugLn('TGtk3WidgetSet.AppRestore missing'); + if Screen=nil then exit; + for i:= Screen.CustomFormZOrderCount-1 downto 0 do + begin + AForm:=Screen.CustomFormsZOrdered[i]; + if (AForm.Parent=nil) and AForm.HandleAllocated and + (TGtk3Widget(AForm.Handle).Visible) and + not (AForm.FormStyle in [fsMDIChild, fsSplash]) and + not (AForm.BorderStyle in [bsNone]) then + PGtkWindow(TGtk3Window(AForm.Handle).Widget)^.deiconify; + end; end; procedure TGtk3WidgetSet.AppBringToFront; begin - DebugLn('TGtk3WidgetSet.AppBringToFront missing'); + if Assigned(Application.MainForm) and Application.MainForm.HandleAllocated then + begin + TGtk3Window(Application.MainForm.Handle).raiseWidget; + gdk_window_focus(TGtk3Window(Application.MainForm.Handle).Widget^.window, + gtk_get_current_event_time); + end; end; - procedure TGtk3WidgetSet.AppSetIcon(const Small, Big: HICON); var DoDestroyIcon: Boolean; diff --git a/lcl/interfaces/gtk3/gtk3winapi.inc b/lcl/interfaces/gtk3/gtk3winapi.inc index 84b8070a24..475437de8c 100644 --- a/lcl/interfaces/gtk3/gtk3winapi.inc +++ b/lcl/interfaces/gtk3/gtk3winapi.inc @@ -706,6 +706,7 @@ var else begin theRect.Right := theRect.Left + Min(MaxWidth, AP.cX); + theRect.Bottom := theRect.Top + AP.cY; if (Flags and DT_VCENTER) > 0 then begin OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)) div 2); @@ -753,7 +754,7 @@ var theRect.Right := theRect.Left + LineWidth; theRect.Bottom := theRect.Top + LineHeight; if NumLines>1 then - Inc(theRect.Bottom, (NumLines-1)*TM.tmDescent);// space between lines + Inc(theRect.Bottom, (NumLines-1)*TM.tmExternalLeading);// space between lines //DebugLn('TGtk3WidgetSet.DrawText A ',dbgs(theRect),' TM.tmHeight=',dbgs(TM.tmHeight), // ' LineWidth=',dbgs(LineWidth),' NumLines=',dbgs(NumLines)); @@ -1001,7 +1002,7 @@ begin if theRect.Top > theRect.Bottom then Break; if ((Flags and DT_EDITCONTROL) = DT_EDITCONTROL) - and (tm.tmHeight > (theRect.Bottom - theRect.Top)) + and (tm.tmHeight > (theRect.Bottom - theRect.Top+1)) then Break; if Lines[i] <> nil then @@ -1015,7 +1016,7 @@ begin end else LineHeight := TM.tmHeight; - Inc(theRect.Top, LineHeight + TM.tmDescent); // space between lines + Inc(theRect.Top, LineHeight + TM.tmExternalLeading); // space between lines end; finally