[Gtk-sharp-list] How to make GdkWindow.Focus work?

Matt Guo matt at mattguo.com
Thu Dec 3 21:52:35 EST 2009


Hey, all,

My system is open-suse 11.1, 32 bits, gnome. I use the lastest
mono-2-6 branch and gtk-sharp-2-12 branch.
Suppose I have started a gcalctool, whose native X window id is
0x6800003, then with following code:

			var win = Gdk.Window.ForeignNew (0x6800003);
			win.Move (40, 40);
			win.Focus(0u);            //it seems that GDK_CURRENT_TIME is 0

I managed to move the window to (40, 40), but failed to bring the
window to front, or make it focused.

So how can I make a window focused with gdk-sharp by giving the native
X window id?

Thank you!

BTW, here is the result of Gdk.Global.SupportedWindowManagerHints on
my machine, I don't know if it helps:
_NET_WM_NAME
_NET_CLOSE_WINDOW
_NET_WM_STATE
_NET_WM_STATE_SHADED
_NET_WM_STATE_MAXIMIZED_HORZ
_NET_WM_STATE_MAXIMIZED_VERT
_NET_WM_DESKTOP
_NET_NUMBER_OF_DESKTOPS
_NET_CURRENT_DESKTOP
_NET_WM_WINDOW_TYPE
_NET_WM_WINDOW_TYPE_DESKTOP
_NET_WM_WINDOW_TYPE_DOCK
_NET_WM_WINDOW_TYPE_TOOLBAR
_NET_WM_WINDOW_TYPE_MENU
_NET_WM_WINDOW_TYPE_DIALOG
_NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_STATE_MODAL
_NET_CLIENT_LIST
_NET_CLIENT_LIST_STACKING
_NET_WM_STATE_SKIP_TASKBAR
_NET_WM_STATE_SKIP_PAGER
_NET_WM_ICON_NAME
_NET_WM_ICON
_NET_WM_ICON_GEOMETRY
_NET_WM_MOVERESIZE
_NET_ACTIVE_WINDOW
_NET_WM_STRUT
_NET_WM_STATE_HIDDEN
_NET_WM_WINDOW_TYPE_UTILITY
_NET_WM_WINDOW_TYPE_SPLASH
_NET_WM_STATE_FULLSCREEN
_NET_WM_PING
_NET_WM_PID
_NET_WORKAREA
_NET_SHOWING_DESKTOP
_NET_DESKTOP_LAYOUT
_NET_DESKTOP_NAMES
_NET_WM_ALLOWED_ACTIONS
_NET_WM_ACTION_MOVE
_NET_WM_ACTION_RESIZE
_NET_WM_ACTION_SHADE
_NET_WM_ACTION_STICK
_NET_WM_ACTION_MAXIMIZE_HORZ
_NET_WM_ACTION_MAXIMIZE_VERT
_NET_WM_ACTION_CHANGE_DESKTOP
_NET_WM_ACTION_CLOSE
_NET_WM_STATE_ABOVE
_NET_WM_STATE_BELOW
_NET_STARTUP_ID
_NET_WM_STRUT_PARTIAL
_NET_WM_ACTION_FULLSCREEN
_NET_WM_ACTION_MINIMIZE
_NET_FRAME_EXTENTS
_NET_REQUEST_FRAME_EXTENTS
_NET_WM_USER_TIME
_NET_WM_STATE_DEMANDS_ATTENTION
_NET_MOVERESIZE_WINDOW
_NET_DESKTOP_GEOMETRY
_NET_DESKTOP_VIEWPORT
_NET_WM_USER_TIME_WINDOW
_NET_WM_ACTION_ABOVE
_NET_WM_ACTION_BELOW

-- 
B.R.
GUO Rui (Matt)


More information about the Gtk-sharp-list mailing list