disable x11 window's resize for graph_xlib

This commit is contained in:
houzh 2023-03-20 07:02:54 +00:00
parent 7ad21beea2
commit 67589b71c3

View File

@ -7,6 +7,7 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <pthread.h>
#include <string.h>
#include <core/eventcodes.h>
@ -82,6 +83,7 @@ INT GFXInit(){
pthread_t tid;
XSetWindowAttributes winattrs;
XGCValues values;
XSizeHints sizehints;
int width,height;
int screen=DefaultScreen(x11Display);
x11Visual = DefaultVisual(x11Display, screen);
@ -89,6 +91,13 @@ INT GFXInit(){
x11Window=XCreateSimpleWindow(x11Display, RootWindow(x11Display, screen), 0, 0,width,height, 1,
BlackPixel(x11Display, screen), WhitePixel(x11Display, screen));
sizehints.flags = PMinSize | PMaxSize;
sizehints.min_width = width;
sizehints.max_width = width;
sizehints.min_height = height;
sizehints.max_height = height;
XSetWMNormalHints(x11Display,x11Window,&sizehints);
WM_DELETE_WINDOW = XInternAtom(x11Display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(x11Display,x11Window, &WM_DELETE_WINDOW, 1);
mainGC = XCreateGC(x11Display,x11Window,0, &values);