ycsunjane 发表于 2012-1-16 21:44:48

gtk_window_set_gravity问题

#include <gtk/gtk.h>
int main(int argc, const char *argv[])
{
      GtkWidget *window;
      gtk_init(&argc,&argv);
      window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
      gtk_window_set_title(GTK_WINDOW(window),"hello world");

      gtk_window_set_gravity(GTK_WINDOW(window),GDK_GRAVITY_SOUTH);
//为什么这句话不起效果,永远都在左上角
      gtk_window_move(GTK_WINDOW(window),300,200);

      gtk_widget_show(window);
      gtk_main();
      return 0;
}
~      

zjhxmjl 发表于 2012-1-17 11:37:29

你所指的左上角是什么意思?

electricface 发表于 2012-3-4 12:48:42

Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown.

electricface 发表于 2012-3-4 13:49:09

回 electricface 的帖子

electricface:Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown. (2012-03-04 12:48) images/back.gif

gtk_window_move (GTK_WINDOW(window),4000,4000);
将窗体显示到右下角,像360的弹窗。

zjhxmjl 发表于 2012-3-13 13:13:05

我也试过,不知问题所在,希望有解决方法的话贴上来,不过窗口位置也可以用这个函数gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_MOUSE);
页: [1]
查看完整版本: gtk_window_set_gravity问题