[gtkmm] Add Gdk::Monitor



commit 6da762b905b419d895c6e0b9ad7f8be8515fcd36
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Fri May 27 16:17:53 2016 +0200

    Add Gdk::Monitor
    
    * .gitignore: Add monitor.[h|cc].
    * gdk/gdkmm.h: Add monitor.h.
    * gdk/src/filelist.am: Add monitor.hg.
    * gdk/src/monitor.[hg|ccg]: New files.
    * tools/m4/convert_gdk.m4: Add conversions for GdkMonitor and GdkSubpixelLayout.

 .gitignore              |    2 +
 gdk/gdkmm.h             |    1 +
 gdk/src/filelist.am     |    1 +
 gdk/src/monitor.ccg     |   18 ++++++++++
 gdk/src/monitor.hg      |   81 +++++++++++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gdk.m4 |    4 ++
 6 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index d6a068d..68f56d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,6 +68,8 @@ gdk/gdkmm/event.cc
 gdk/gdkmm/event.h
 gdk/gdkmm/glcontext.cc
 gdk/gdkmm/glcontext.h
+gdk/gdkmm/monitor.cc
+gdk/gdkmm/monitor.h
 gdk/gdkmm/pixbuf.cc
 gdk/gdkmm/pixbuf.h
 gdk/gdkmm/pixbufanimation.cc
diff --git a/gdk/gdkmm.h b/gdk/gdkmm.h
index 256d420..6027387 100644
--- a/gdk/gdkmm.h
+++ b/gdk/gdkmm.h
@@ -37,6 +37,7 @@
 #include <gdkmm/devicemanager.h>
 #include <gdkmm/screen.h>
 #include <gdkmm/seat.h>
+#include <gdkmm/monitor.h>
 #include <gdkmm/general.h>
 
 #endif /* _GDKMM_GDKMM_H_ */
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index dc7257a..e7e3dd2 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -22,6 +22,7 @@ gdkmm_files_any_hg =          \
        dragcontext.hg          \
        event.hg                \
        glcontext.hg            \
+       monitor.hg \
        pixbuf.hg               \
        pixbufanimation.hg      \
        pixbufanimationiter.hg  \
diff --git a/gdk/src/monitor.ccg b/gdk/src/monitor.ccg
new file mode 100644
index 0000000..4a2d2ab
--- /dev/null
+++ b/gdk/src/monitor.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2016 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gdkmm/display.h>
+
diff --git a/gdk/src/monitor.hg b/gdk/src/monitor.hg
new file mode 100644
index 0000000..953273f
--- /dev/null
+++ b/gdk/src/monitor.hg
@@ -0,0 +1,81 @@
+/* Copyright (C) 2016 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <gdkmm/rectangle.h>
+
+_DEFS(gdkmm,gdk)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gdk
+{
+_WRAP_ENUM(SubpixelLayout, GdkSubpixelLayout)
+
+class Display;
+
+/** Object representing an output.
+ *
+ * Gdk::Monitor objects represent the individual outputs that are
+ * associated with a Gdk::Display. Display has APIs to enumerate
+ * monitors with Display::get_n_monitors() and Display::get_monitor()
+ * and to find particular monitors with Display::get_primary_monitor(),
+ * Display::get_monitor_at_point() or Display::get_monitor_at_window().
+ *
+ * Monitor was introduced in gtkmm 3.22 and supersedes earlier
+ * APIs in Gdk::Screen to obtain monitor-related information.
+ *
+ * @newin{3,22}
+ */
+class Monitor : public Glib::Object
+{
+  _CLASS_GOBJECT(Monitor, GdkMonitor, GDK_MONITOR, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  _WRAP_METHOD(Glib::RefPtr<Display> get_display(), gdk_monitor_get_display, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Display> get_display() const, gdk_monitor_get_display, refreturn, 
constversion)
+  _WRAP_METHOD(void get_geometry(Rectangle& geometry) const, gdk_monitor_get_geometry)
+  _WRAP_METHOD(void get_workarea(Rectangle& workarea) const, gdk_monitor_get_workarea)
+  _WRAP_METHOD(int get_width_mm() const, gdk_monitor_get_width_mm)
+  _WRAP_METHOD(int get_height_mm() const, gdk_monitor_get_height_mm)
+  _WRAP_METHOD(Glib::ustring get_manufacturer() const, gdk_monitor_get_manufacturer)
+  _WRAP_METHOD(Glib::ustring get_model() const, gdk_monitor_get_model)
+  _WRAP_METHOD(int get_scale_factor() const, gdk_monitor_get_scale_factor)
+  _WRAP_METHOD(int get_refresh_rate() const, gdk_monitor_get_refresh_rate)
+  _WRAP_METHOD(SubpixelLayout get_subpixel_layout() const, gdk_monitor_get_subpixel_layout)
+  _WRAP_METHOD(bool is_primary() const, gdk_monitor_is_primary)
+
+  //TODO: Wrap or ignore GdkMonitor::invalidate. It's not documented.
+  // I don't know if it's meant to be used outside gtk+. /Kjell
+  // We use no_default_handler because _GdkMonitorClass is private
+  // and there is no default handler in gtk+.
+  //_WRAP_SIGNAL(void invalidate(), "invalidate", no_default_handler)
+
+  _WRAP_PROPERTY("display", Glib::RefPtr<Display>)
+  _WRAP_PROPERTY("manufacturer", Glib::ustring)
+  _WRAP_PROPERTY("model", Glib::ustring)
+  _WRAP_PROPERTY("scale-factor", int)
+  _WRAP_PROPERTY("geometry", Gdk::Rectangle)
+  _WRAP_PROPERTY("workarea", Gdk::Rectangle)
+  _WRAP_PROPERTY("width-mm", int)
+  _WRAP_PROPERTY("height-mm", int)
+  _WRAP_PROPERTY("refresh-rate", int)
+  _WRAP_PROPERTY("subpixel-layout", SubpixelLayout)
+};
+
+} // namespace Gdk
diff --git a/tools/m4/convert_gdk.m4 b/tools/m4/convert_gdk.m4
index d982889..0661764 100644
--- a/tools/m4/convert_gdk.m4
+++ b/tools/m4/convert_gdk.m4
@@ -57,6 +57,7 @@ _CONV_ENUM(Gdk,PixbufAlphaMode)
 _CONV_ENUM(Gdk,RgbDither)
 _CONV_ENUM(Gdk,SeatCapabilities)
 _CONV_ENUM(Gdk,Status)
+_CONV_ENUM(Gdk,SubpixelLayout)
 _CONV_ENUM(Gdk,SubwindowMode)
 _CONV_ENUM(Gdk,VisualType)
 _CONV_ENUM(Gdk,WindowAttributesType)
@@ -239,6 +240,9 @@ _CONVERSION(`GdkSeat*',`Glib::RefPtr<Gdk::Seat>', `Glib::wrap($3)')
 _CONVERSION(`GdkSeat*',`Glib::RefPtr<const Seat>', `Glib::wrap($3)')
 _CONVERSION(`GdkSeat*',`Glib::RefPtr<const Gdk::Seat>', `Glib::wrap($3)')
 
+_CONVERSION(`GdkMonitor*',`Glib::RefPtr<Monitor>', `Glib::wrap($3)')
+_CONVERSION(`GdkMonitor*',`Glib::RefPtr<const Monitor>', `Glib::wrap($3)')
+
 _CONVERSION(`GdkDeviceManager*',`Glib::RefPtr<DeviceManager>', `Glib::wrap($3)')
 _CONVERSION(`GdkDeviceManager*',`Glib::RefPtr<const DeviceManager>', `Glib::wrap($3)')
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]