Example #1
0
void xf_transform_window(xfContext *xfc)
{
	int ret;
	int w;
	int h;
	long supplied;
	Atom hints_atom;
	XSizeHints *size_hints = NULL;
	hints_atom = XInternAtom(xfc->display, "WM_SIZE_HINTS", 1);
	ret = XGetWMSizeHints(xfc->display, xfc->window->handle, size_hints, &supplied, hints_atom);
	if(ret == 0)
		size_hints = XAllocSizeHints();
	w = (xfc->originalWidth * xfc->settings->ScalingFactor) + xfc->offset_x;
	h = (xfc->originalHeight * xfc->settings->ScalingFactor) + xfc->offset_y;
	if(w < 1)
		w = 1;
	if(h < 1)
		h = 1;
	if(size_hints)
	{
		size_hints->flags |= PMinSize | PMaxSize;
		size_hints->min_width = size_hints->max_width = w;
		size_hints->min_height = size_hints->max_height = h;
		XSetWMNormalHints(xfc->display, xfc->window->handle, size_hints);
		XResizeWindow(xfc->display, xfc->window->handle, w, h);
		XFree(size_hints);
	}
}
Example #2
0
Status XGetWMNormalHints (
    Display *dpy,
    Window w,
    XSizeHints *hints,
    long *supplied)
{
    return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS));
}