View Issue Details

IDProjectCategoryView StatusLast Update
0036963LazarusWidgetsetpublic2020-04-24 20:13
ReporterAnton Kavalenka Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.1 (SVN) 
Summary0036963: gtk3: GDK api for GDkMonitor
DescriptionPatch for LazGdk3
TagsNo tags attached.
Fixed in Revision63056
LazTarget-
WidgetsetGTK 3
Attached Files

Relationships

related to 0036946 closedJuha Manninen gtk3: Make Screen.WorkArea work 

Activities

Anton Kavalenka

2020-04-24 14:49

reporter  

lazgdk3.diff (4,528 bytes)   
Index: lcl/interfaces/gtk3/gtk3bindings/lazgdk3.pas
===================================================================
--- lcl/interfaces/gtk3/gtk3bindings/lazgdk3.pas	(revision 63051)
+++ lcl/interfaces/gtk3/gtk3bindings/lazgdk3.pas	(working copy)
@@ -3891,7 +3891,31 @@
   TGdkWindowRedirect = record
   end;
 
+  TGdkSubpixelLayout = (
+    GDK_SUBPIXEL_LAYOUT_UNKNOWN, // The layout is not known
+    GDK_SUBPIXEL_LAYOUT_NONE, // Not organized in this way
+    GDK_SUBPIXEL_LAYOUT_HORIZONTAL_RGB, // The layout is horizontal, the order is RGB
+    GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR, // The layout is horizontal, the order is BGR
+    GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB, // The layout is vertical, the order is RGB
+    GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR // The layout is vertical, the order is BGR
+  );
 
+  { TGdkMonitor available since 3.22 }
+  PGdkMonitor = ^TGdkMonitor;
+  TGdkMonitor = object(TGObject)
+  public
+    function get_display ():PGdkDisplay;cdecl;inline;
+    procedure	geometry (geometry:PGdkRectangle);cdecl;inline;
+    procedure get_workarea (workarea:PGdkRectangle);cdecl;inline;
+    function get_width_mm():integer;cdecl;inline;
+    function get_height_mm():integer;cdecl;inline;
+    function get_manufacturer ():PChar;cdecl;inline;
+    function get_model ():PChar;cdecl;inline;
+    function get_scale_factor ():integer;cdecl;inline;
+    function get_refresh_rate ():integer;cdecl;inline;
+    function get_subpixel_layout ():TGdkSubpixelLayout;cdecl;inline;
+    function is_primary ():gboolean;cdecl;inline;
+  end;
 
 function gdk_app_launch_context_get_type: TGType; cdecl; external;
 function gdk_atom_intern(atom_name: Pgchar; only_if_exists: gboolean): PGdkAtom; cdecl; external;
@@ -4364,7 +4388,80 @@
 procedure gdk_window_unmaximize(window: PGdkWindow); cdecl; external;
 procedure gdk_window_unstick(window: PGdkWindow); cdecl; external;
 procedure gdk_window_withdraw(window: PGdkWindow); cdecl; external;
+
+{ GDK monitor available since 3.22 }
+function gdk_monitor_get_display (monitor:PGdkMonitor):PGdkDisplay;cdecl;external;
+procedure gdk_monitor_get_geometry (monitor: PGdkMonitor; geometry:PGdkRectangle);cdecl;external;
+procedure gdk_monitor_get_workarea (monitor: PGdkMonitor; workarea:PGdkRectangle);cdecl;external;
+function gdk_monitor_get_width_mm(monitor:PGdkMonitor):integer;cdecl;external;
+function gdk_monitor_get_height_mm (monitor:PGdkMonitor):integer;cdecl;external;
+function gdk_monitor_get_manufacturer (monitor:PGdkMonitor):PChar;cdecl;external;
+function gdk_monitor_get_model (monitor:PGdkMonitor):PChar;cdecl;external;
+function gdk_monitor_get_scale_factor (monitor:PGdkMonitor):integer;cdecl;external;
+function gdk_monitor_get_refresh_rate (monitor:PGdkMonitor):integer;cdecl;external;
+function gdk_monitor_get_subpixel_layout (monitor:PGdkMonitor):TGdkSubpixelLayout;cdecl;external;
+function gdk_monitor_is_primary (monitor:PGdkMonitor):gboolean;cdecl;external;
+
+
 implementation
+
+{ TGdkMonitor }
+
+function TGdkMonitor.get_display(): PGdkDisplay; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_display (@Self);
+end;
+
+procedure TGdkMonitor.geometry(geometry: PGdkRectangle); cdecl;
+begin
+  LazGdk3.gdk_monitor_get_geometry (@Self, geometry);
+end;
+
+procedure TGdkMonitor.get_workarea(workarea: PGdkRectangle); cdecl;
+begin
+  LazGdk3.gdk_monitor_get_workarea (@Self, workarea);
+end;
+
+function TGdkMonitor.get_width_mm(): integer; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_width_mm(@Self);
+end;
+
+function TGdkMonitor.get_height_mm(): integer; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_height_mm (@Self);
+end;
+
+function TGdkMonitor.get_manufacturer(): PChar; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_manufacturer(@Self);
+end;
+
+function TGdkMonitor.get_model(): PChar; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_model(@Self);
+end;
+
+function TGdkMonitor.get_scale_factor(): integer; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_scale_factor(@Self);
+end;
+
+function TGdkMonitor.get_refresh_rate(): integer; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_refresh_rate(@Self);
+end;
+
+function TGdkMonitor.get_subpixel_layout(): TGdkSubpixelLayout; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_get_subpixel_layout(@Self);
+end;
+
+function TGdkMonitor.is_primary(): gboolean; cdecl;
+begin
+  Result:=LazGdk3.gdk_monitor_is_primary(@Self);
+end;
+
 procedure TGdkAppLaunchContext.set_desktop(desktop: gint); cdecl;
 begin
   LazGdk3.gdk_app_launch_context_set_desktop(@self, desktop);
lazgdk3.diff (4,528 bytes)   

Zeljan Rikalo

2020-04-24 15:25

developer   ~0122382

Please test and close if ok.

Issue History

Date Modified Username Field Change
2020-04-24 14:49 Anton Kavalenka New Issue
2020-04-24 14:49 Anton Kavalenka File Added: lazgdk3.diff
2020-04-24 15:23 Zeljan Rikalo Assigned To => Zeljan Rikalo
2020-04-24 15:23 Zeljan Rikalo Status new => assigned
2020-04-24 15:24 Zeljan Rikalo Relationship added related to 0036946
2020-04-24 15:25 Zeljan Rikalo Status assigned => resolved
2020-04-24 15:25 Zeljan Rikalo Resolution open => fixed
2020-04-24 15:25 Zeljan Rikalo Fixed in Revision => 63056
2020-04-24 15:25 Zeljan Rikalo LazTarget => -
2020-04-24 15:25 Zeljan Rikalo Widgetset GTK 3 => GTK 3
2020-04-24 15:25 Zeljan Rikalo Note Added: 0122382
2020-04-24 20:13 Anton Kavalenka Status resolved => closed