[英]window always on top using xlib
I'm in the process of creating a gtk2 application which I would like drawn over all other apps at all times, I would rather use xlib to do that if it is possible 我正在创建一个gtk2应用程序,我想一直将其绘制在所有其他应用程序上,我宁愿使用xlib来做到这一点
here's my code so far: 到目前为止,这是我的代码:
#include <gtk/gtk.h>
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *mainwin;
mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show_all (mainwin);
gtk_main ();
return 0;
}
I'd like to do this in the simplest manner possible thanks 我想以最简单的方式做到这一点,谢谢
Yes it is possible and not complicated 是的,这是可能的,并不复杂
#include <gtk/gtk.h>
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *mainwin;
mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_keep_above ( (GtkWindow *) mainwin, TRUE);
gtk_widget_show_all (mainwin);
gtk_main ();
return 0;
}
gtk_window_set_keep_above does trick if window manager is cooperative. 如果窗口管理器是协作的,则gtk_window_set_keep_above会欺骗。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.