There's a patch for libwnck so that it implements a method for setting
the geometry for a window (wnck_window_set_geometry() in the patch for
GNOME bug 342899[1]). In my attempts to add a python binding for this
I've run into some problems with one of the enums:

 wnck.c: In function '_wrap_wnck_window_set_geometry':
 wnck.c:1562: error: 'WNCK_TYPE_WINDOW_MOVERESIZEMASK' undeclared (first use in 
this function)
 wnck.c:1562: error: (Each undeclared identifier is reported only once
 wnck.c:1562: error: for each function it appears in.)
 wnck.c: In function 'pywnck_add_constants':
 wnck.c:2009: error: 'WNCK_TYPE_WINDOW_MOVERESIZEMASK' undeclared (first use in 
this function)

The patch is at the end of the email.

I have two questions:
 1. What's the difference between enum and flags for pygtk-codegen, and
    when should I use which?
 2. How do i derive the gtype-id? (I seem to have done it right for
    WnckWindowGravity but not for WnckWindowMoveResizeMask.)

/M

1. http://bugzilla.gnome.org/show_bug.cgi?id=342899


Index: python-gnome2-extras/gnome-python-extras-2.12.1/wnck/wnck.defs
===================================================================
--- python-gnome2-extras.orig/gnome-python-extras-2.12.1/wnck/wnck.defs 
2006-05-30 07:55:33.000000000 +0100
+++ python-gnome2-extras/gnome-python-extras-2.12.1/wnck/wnck.defs      
2006-05-30 08:10:34.000000000 +0100
@@ -132,6 +132,36 @@
   )
 )
 
+(define-enum WindowGravity
+  (in-module "Wnck")
+  (c-name "WnckWindowGravity")
+  (gtype-id "WNCK_TYPE_WINDOW_GRAVITY")
+  (values
+    '("current" "WNCK_WINDOW_GRAVITY_CURRENT")
+    '("northwest" "WNCK_WINDOW_GRAVITY_NORTHWEST")
+    '("north" "WNCK_WINDOW_GRAVITY_NORTH")
+    '("northeast" "WNCK_WINDOW_GRAVITY_NORTHEAST")
+    '("west" "WNCK_WINDOW_GRAVITY_WEST")
+    '("center" "WNCK_WINDOW_GRAVITY_CENTER")
+    '("east" "WNCK_WINDOW_GRAVITY_EAST")
+    '("southwest" "WNCK_WINDOW_GRAVITY_SOUTHWEST")
+    '("south" "WNCK_WINDOW_GRAVITY_SOUTH")
+    '("southeast" "WNCK_WINDOW_GRAVITY_SOUTHEAST")
+  )
+)
+
+(define-enum WindowMoveResizeMask
+  (in-module "Wnck")
+  (c-name "WnckWindowMoveResizeMask")
+  (gtype-id "WNCK_TYPE_WINDOW_MOVERESIZEMASK")
+  (values
+    '("change-x" "WNCK_WINDOW_CHANGE_X")
+    '("change-y" "WNCK_WINDOW_CHANGE_Y")
+    '("change-width" "WNCK_WINDOW_CHANGE_WIDTH")
+    '("change-height" "WNCK_WINDOW_CHANGE_HEIGHT")
+  )
+)
+
 
 ;; From /usr/include/libwnck-1.0/libwnck/application.h
 
@@ -1033,6 +1063,20 @@
   )
 )
 
+(define-method set_geometry
+  (of-object "WnckWindow")
+  (c-name "wnck_window_set_geometry")
+  (return-type "none")
+  (parameters
+    '("WnckWindowGravity" "gravity")
+    '("WnckWindowMoveResizeMask" "geometry_mask")
+    '("int" "x")
+    '("int" "y")
+    '("int" "width")
+    '("int" "height")
+  )
+)
+
 (define-method is_visible_on_workspace
   (of-object "WnckWindow")
   (c-name "wnck_window_is_visible_on_workspace")

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
[EMAIL PROTECTED]             Jabber: [EMAIL PROTECTED]
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Time is a great teacher, but unfortunately it kills all its pupils.
     -- Hector Louis Berlioz

Attachment: pgpTwIAvWyuNc.pgp
Description: PGP signature

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to