Beispiel #1
0
func (s *sysData) center() {
	ret := make(chan struct{})
	defer close(ret)
	uitask <- func() {
		if C.gtk_widget_get_visible(s.widget) == C.FALSE {
			// hint to the WM to make it centered when it is shown again
			// thanks to Jasper in irc.gimp.net/#gtk+
			C.gtk_window_set_position(togtkwindow(s.widget), C.GTK_WIN_POS_CENTER)
		} else {
			var width, height C.gint

			s.resetposition()
			//we should be able to use gravity to simplify this, but it doesn't take effect immediately, and adding show calls does nothing (thanks Jasper in irc.gimp.net/#gtk+)
			C.gtk_window_get_size(togtkwindow(s.widget), &width, &height)
			C.gtk_window_move(togtkwindow(s.widget),
				(C.gdk_screen_width()/2)-(width/2),
				(C.gdk_screen_height()/2)-(width/2))
		}
		ret <- struct{}{}
	}
	<-ret
}
Beispiel #2
0
func (w *Window) SetPosition(x, y int) {
	C.gtk_window_move((*C.GtkWindow)(unsafe.Pointer(w.gtkWin)),
		C.gint(x), C.gint(y))
}
Beispiel #3
0
// Move is a wrapper around gtk_window_move().
func (v *Window) Move(x, y int) {
	C.gtk_window_move(v.native(), C.gint(x), C.gint(y))
}