本文主要是介绍x11 simple-wm-hints,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
窗口的标识设置样例。
- 得到 icon 的图片
/* load the given bitmap data and create an X pixmap contianing it. */icon_pixmap = XCreateBitmapFromData(display,win,icon_bitmap_bits,icon_bitmap_width,icon_bitmap_height);if (!icon_pixmap) {fprintf(stderr, "XCreateBitmapFromData - error creating pixmap\n");exit(1);}
- 初始化 标识 内存
/* allocate a WM hints structure. */win_hints = XAllocWMHints();if (!win_hints) {fprintf(stderr, "XAllocWMHints - out of memory\n");exit(1);}/* initialize the structure appropriatly. *//* first, specify which size hints we want to fill in. *//* in our case - setting the icon's pixmap, setting the *//* state hint as well as the icon position hint. */win_hints->flags = IconPixmapHint | StateHint | IconPositionHint;/* next, specify the desired ihnts data. *//* in our case - supply the icon's desired pixmap. *//* make the window's initial state be iconized, *//* and set the icon position to the top-left part *//* of the screen. */win_hints->icon_pixmap = icon_pixmap;win_hints->initial_state = IconicState;win_hints->icon_x = 0;win_hints->icon_y = 0;
- 在窗口中设置窗口标识
/* pass the hints to the window manager. */XSetWMHints(display, win, win_hints);
- 将标识的内存释放
/* finally, we can free the WM hints structure. */XFree(win_hints);
这篇关于x11 simple-wm-hints的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!