[gtkmm] gdk: Device: Add get_position() that uses doubles.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] gdk: Device: Add get_position() that uses doubles.
- Date: Mon, 29 Jul 2013 09:04:34 +0000 (UTC)
commit 0c492ffa455cf6e8eb70ec371a802ba05be2ad9b
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Jul 29 10:45:51 2013 +0200
gdk: Device: Add get_position() that uses doubles.
Wrapping gdk_device_get_position_double().
gdk/src/device.ccg | 12 +++++
gdk/src/device.hg | 46 +++++++++++++++++++-
gdk/src/gdk_enums.defs | 12 ++---
gdk/src/gdk_methods.defs | 108 +++++++++++++++++++++++++++++++++++++++++-----
4 files changed, 158 insertions(+), 20 deletions(-)
---
diff --git a/gdk/src/device.ccg b/gdk/src/device.ccg
index 2809c10..c05b30a 100644
--- a/gdk/src/device.ccg
+++ b/gdk/src/device.ccg
@@ -46,6 +46,18 @@ void Device::get_position(Glib::RefPtr<Screen>& screen, int& x, int& y) const
screen = Glib::wrap(cScreen, true);
}
+void Device::get_position(double& x, double& y) const
+{
+ gdk_device_get_position_double(const_cast<GdkDevice*>(gobj()), 0, &x, &y);
+}
+
+void Device::get_position(Glib::RefPtr<Screen>& screen, double& x, double& y) const
+{
+ GdkScreen* cScreen = 0;
+ gdk_device_get_position_double(const_cast<GdkDevice*>(gobj()), &cScreen, &x, &y);
+ screen = Glib::wrap(cScreen, true);
+}
+
Glib::RefPtr<Window> Device::get_window_at_position()
{
Glib::RefPtr<Window> retvalue = Glib::wrap(gdk_device_get_window_at_position(gobj(), 0, 0));
diff --git a/gdk/src/device.hg b/gdk/src/device.hg
index 2a329c2..63ac5d7 100644
--- a/gdk/src/device.hg
+++ b/gdk/src/device.hg
@@ -102,13 +102,55 @@ public:
_WRAP_METHOD(void ungrab(guint32 time_), gdk_device_ungrab)
_WRAP_METHOD(void warp(const Glib::RefPtr<Screen>& screen, int x, int y), gdk_device_warp)
- // TODO: docs.
+ /** Gets the current location of the device.
+ * As a slave device coordinates are those of its master pointer,
+ * this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them. See grab().
+ *
+ * @param x This will contain the root window X coordinate of the device.
+ * @param y This will contain the root window X coordinate of the device.
+ */
void get_position(int& x, int& y) const;
- // TODO: docs.
+ /** Gets the current location of device.
+ * As a slave device coordinates are those of its master pointer,
+ * this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them. See grab().
+ *
+ * @param screen This will contain the screen that the device is on.
+ * @param x This will contain the root window X coordinate of the device.
+ * @param y This will contain the root window X coordinate of the device.
+ */
void get_position(Glib::RefPtr<Screen>& screen, int& x, int& y) const;
_IGNORE(gdk_device_get_position)
+
+ /** Gets the current location of the device in double precision.
+ * As a slave device coordinates are those of its master pointer,
+ * this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them. See grab().
+ *
+ * @param x This will contain the root window X coordinate of the device.
+ * @param y This will contain the root window X coordinate of the device.
+ *
+ * @newin{3,10}
+ */
+ void get_position(double& x, double& y) const;
+
+ /** Gets the current location of the device in double precision.
+ * As a slave device coordinates are those of its master pointer,
+ * this function may not be called on devices of type GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them. See grab().
+ *
+ * @param screen This will contain the screen that the device is on.
+ * @param x This will contain the root window X coordinate of the device.
+ * @param y This will contain the root window X coordinate of the device.
+ *
+ * @newin{3,10}
+ */
+ void get_position(Glib::RefPtr<Screen>& screen, double& x, double& y) const;
+ _IGNORE(gdk_device_get_position_double)
+
_WRAP_METHOD(Glib::RefPtr<Window> get_window_at_position(int& win_x, int& win_y),
gdk_device_get_window_at_position, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Window> get_window_at_position(int& win_x, int& win_y) const,
gdk_device_get_window_at_position, refreturn, constversion)
diff --git a/gdk/src/gdk_enums.defs b/gdk/src/gdk_enums.defs
index 64b46c0..3243ef2 100644
--- a/gdk/src/gdk_enums.defs
+++ b/gdk/src/gdk_enums.defs
@@ -385,12 +385,6 @@
;; GDK_EVENT_LAST /* helper variable for decls */
;; } GdkEventType;
-;; Removed GDK_DOUBLE_BUTTON_PRESS and GDK_TRIPLE_BUTTON_PRESS manually.
-;; This is not necessary, if everyone uses gmmproc in glibmm 2.35.8 or later
-;; and _WRAP_ENUM(EventType...) contains substitution commands that delete
-;; those constants. I've removed them now to be nice to those that still
-;; use an older version of gmmproc. /Kjell Ahlstedt 2013-03-01.
-
(define-enum-extended EventType
(in-module "Gdk")
(c-name "GdkEventType")
@@ -402,7 +396,9 @@
'("motion-notify" "GDK_MOTION_NOTIFY" "3")
'("button-press" "GDK_BUTTON_PRESS" "4")
'("2button-press" "GDK_2BUTTON_PRESS" "5")
+ '("double-button-press" "GDK_DOUBLE_BUTTON_PRESS" "5")
'("3button-press" "GDK_3BUTTON_PRESS" "6")
+ '("triple-button-press" "GDK_TRIPLE_BUTTON_PRESS" "6")
'("button-release" "GDK_BUTTON_RELEASE" "7")
'("key-press" "GDK_KEY_PRESS" "8")
'("key-release" "GDK_KEY_RELEASE" "9")
@@ -560,7 +556,8 @@
;; GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
;; GDK_WINDOW_STATE_ABOVE = 1 << 5,
;; GDK_WINDOW_STATE_BELOW = 1 << 6,
-;; GDK_WINDOW_STATE_FOCUSED = 1 << 7
+;; GDK_WINDOW_STATE_FOCUSED = 1 << 7,
+;; GDK_WINDOW_STATE_TILED = 1 << 8
;; } GdkWindowState;
(define-flags-extended WindowState
@@ -575,6 +572,7 @@
'("above" "GDK_WINDOW_STATE_ABOVE" "1 << 5")
'("below" "GDK_WINDOW_STATE_BELOW" "1 << 6")
'("focused" "GDK_WINDOW_STATE_FOCUSED" "1 << 7")
+ '("tiled" "GDK_WINDOW_STATE_TILED" "1 << 8")
)
)
diff --git a/gdk/src/gdk_methods.defs b/gdk/src/gdk_methods.defs
index 964c5c7..9fa32a3 100644
--- a/gdk/src/gdk_methods.defs
+++ b/gdk/src/gdk_methods.defs
@@ -63,12 +63,6 @@
(gtype-id "GDK_TYPE_KEYMAP")
)
-(define-object Paintable
- (in-module "Gdk")
- (c-name "GdkPaintable")
- (gtype-id "GDK_TYPE_PAINTABLE")
-)
-
(define-object Screen
(in-module "Gdk")
(parent "GObject")
@@ -315,6 +309,7 @@
'("above" "GDK_WINDOW_STATE_ABOVE")
'("below" "GDK_WINDOW_STATE_BELOW")
'("focused" "GDK_WINDOW_STATE_FOCUSED")
+ '("tiled" "GDK_WINDOW_STATE_TILED")
)
)
@@ -893,6 +888,16 @@
)
)
+(define-function gdk_cairo_surface_create_from_pixbuf
+ (c-name "gdk_cairo_surface_create_from_pixbuf")
+ (return-type "cairo_surface_t*")
+ (parameters
+ '("const-GdkPixbuf*" "pixbuf")
+ '("int" "scale")
+ '("GdkWindow*" "for_window")
+ )
+)
+
;; From gdkcolor.h
@@ -1150,6 +1155,27 @@
)
)
+(define-method get_position_double
+ (of-object "GdkDevice")
+ (c-name "gdk_device_get_position_double")
+ (return-type "none")
+ (parameters
+ '("GdkScreen**" "screen")
+ '("gdouble*" "x")
+ '("gdouble*" "y")
+ )
+)
+
+(define-method get_window_at_position_double
+ (of-object "GdkDevice")
+ (c-name "gdk_device_get_window_at_position_double")
+ (return-type "GdkWindow*")
+ (parameters
+ '("gdouble*" "win_x")
+ '("gdouble*" "win_y")
+ )
+)
+
(define-method get_history
(of-object "GdkDevice")
(c-name "gdk_device_get_history")
@@ -2795,11 +2821,6 @@
(return-type "const-gchar*")
)
-(define-function gdk_get_display
- (c-name "gdk_get_display")
- (return-type "gchar*")
-)
-
(define-function gdk_pointer_grab
(c-name "gdk_pointer_grab")
(return-type "GdkGrabStatus")
@@ -2887,6 +2908,14 @@
(return-type "none")
)
+(define-function gdk_set_allowed_backends
+ (c-name "gdk_set_allowed_backends")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "backends")
+ )
+)
+
;; From gdkmarshalers.h
@@ -3315,6 +3344,15 @@
)
)
+(define-method get_monitor_scale_factor
+ (of-object "GdkScreen")
+ (c-name "gdk_screen_get_monitor_scale_factor")
+ (return-type "gint")
+ (parameters
+ '("gint" "monitor_num")
+ )
+)
+
(define-function gdk_screen_get_default
(c-name "gdk_screen_get_default")
(return-type "GdkScreen*")
@@ -4088,6 +4126,15 @@
)
)
+(define-method set_invalidate_handler
+ (of-object "GdkWindow")
+ (c-name "gdk_window_set_invalidate_handler")
+ (return-type "none")
+ (parameters
+ '("GdkWindowInvalidateHandlerFunc" "handler")
+ )
+)
+
(define-method has_native
(of-object "GdkWindow")
(c-name "gdk_window_has_native")
@@ -4414,6 +4461,12 @@
)
)
+(define-method get_scale_factor
+ (of-object "GdkWindow")
+ (c-name "gdk_window_get_scale_factor")
+ (return-type "gint")
+)
+
(define-method get_pointer
(of-object "GdkWindow")
(c-name "gdk_window_get_pointer")
@@ -4437,6 +4490,18 @@
)
)
+(define-method get_device_position_double
+ (of-object "GdkWindow")
+ (c-name "gdk_window_get_device_position_double")
+ (return-type "GdkWindow*")
+ (parameters
+ '("GdkDevice*" "device")
+ '("gdouble*" "x")
+ '("gdouble*" "y")
+ '("GdkModifierType*" "mask")
+ )
+)
+
(define-method get_parent
(of-object "GdkWindow")
(c-name "gdk_window_get_parent")
@@ -4473,6 +4538,15 @@
(return-type "GList*")
)
+(define-method get_children_with_user_data
+ (of-object "GdkWindow")
+ (c-name "gdk_window_get_children_with_user_data")
+ (return-type "GList*")
+ (parameters
+ '("gpointer" "user_data")
+ )
+)
+
(define-method get_events
(of-object "GdkWindow")
(c-name "gdk_window_get_events")
@@ -4597,6 +4671,18 @@
)
)
+(define-method create_similar_image_surface
+ (of-object "GdkWindow")
+ (c-name "gdk_window_create_similar_image_surface")
+ (return-type "cairo_surface_t*")
+ (parameters
+ '("cairo_format_t" "format")
+ '("int" "width")
+ '("int" "height")
+ '("int" "scale")
+ )
+)
+
(define-method beep
(of-object "GdkWindow")
(c-name "gdk_window_beep")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]