Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-09-22 00:45:54

goosesensor
Member
Registered: 2019-01-22
Posts: 19

Computing window geometries without shadows

Long story short, I am writing a window tiler similar to QuickTile.  The problem I am having is that using either xlib directly or libwnck, the window geometries are being returned including the shadow backdrop.  What I ultimately want to be able to do is read and set the window geometry without the shadow.  I believe xfwm knows how to do this.  For example: go to Windows Manager -> Keyboard and assign a key to "Right".  Hitting that key will move the window to the right side of the screen, with the shadow clipped off the right edge of the screen.

My question is, can somebody who is familiar with the xfwm code point me to where this boarder is computed, or to perhaps a theme library or other code/library that can be used to get this information?

Much thanks,
Morgan

Offline

#2 2022-09-22 05:50:58

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: Computing window geometries without shadows


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#3 2022-09-22 23:45:02

goosesensor
Member
Registered: 2019-01-22
Posts: 19

Re: Computing window geometries without shadows

Thank you.

I was able to determine the size of the shadows/decorations on CSD windows using the X _GTK_FRAME_EXTENTS atom and some help from hints.c::getCardinalList()

typedef struct {
	unsigned long left;
	unsigned long right;
	unsigned long top;
	unsigned long bottom;
} Extent;

Extent decorationsExtent = {0, 0, 0, 0};
unsigned long *cardinals_p;
int n_cardinals_p;
Atom type;
int format;
unsigned int i;
unsigned long n_cardinals;
unsigned long bytes_after;
unsigned char *propertyData;

Atom gtkFrameExtentAtom = XInternAtom(_xDisplay, "_GTK_FRAME_EXTENTS", false);

int status = XGetWindowProperty(_xDisplay, wnck_window_get_xid(&window),
								gtkFrameExtentAtom,
								0, G_MAXLONG,
								FALSE,
								XA_CARDINAL,
								&type, &format,
								&n_cardinals, &bytes_after,
								(unsigned char **)&propertyData);

if ((status == Success) && (propertyData != NULL) && (type != None)) {

	unsigned long* cardinals = (unsigned long*)propertyData;

	for (int i=0; i<n_cardinals; ++i) {
		unsigned long item = cardinals[i] & ((1LL << format) - 1);
		printf("d[%d]: %d\n", i, item);

		((unsigned long*)(&decorationsExtent))[i] = cardinals[i] & ((1LL << format) - 1);
	}
}

Offline

#4 2022-09-23 04:32:37

KBar
Member
Registered: 2021-11-05
Posts: 689

Re: Computing window geometries without shadows

Interesting. Thanks for sharing.


Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please! tongue

Offline

#5 2022-09-23 07:39:23

Tamaranch
Member
Registered: 2020-12-31
Posts: 321

Re: Computing window geometries without shadows

Alternatively, you can do this by staying pretty much in GTK/Wnck code via a Libxfce4ui helper: https://gitlab.xfce.org/xfce/xfce4-pane … ow.c#L2485

Last edited by Tamaranch (2022-09-23 07:40:58)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.005 seconds, 7 queries executed - Memory usage: 531.2 KiB (Peak: 532.05 KiB) ]