13#include "ctwm_atoms.h"
56 unsigned long valuemask, attrmask;
57 XSetWindowAttributes attributes;
63 if(scr->VirtualScreens == NULL) {
69 attrmask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
70 SubstructureRedirectMask | KeyPressMask | ButtonPressMask |
73 valuemask = CWBackPixel | CWOverrideRedirect | CWEventMask | CWCursor;
74 attributes.override_redirect = True;
75 attributes.event_mask = attrmask;
76 attributes.cursor = cursor;
77 attributes.background_pixel =
Scr->Black;
80 for(nptr =
Scr->VirtualScreens; nptr != NULL; nptr = nptr->
next) {
82 char *geometry = (
char *) nptr->
name;
84 unsigned int w = 0, h = 0;
86 XParseGeometry(geometry, &
x, &
y, &w, &h);
88 if((
x < 0) || (
y < 0) || (w > scr->
rootw) || (h > scr->
rooth)) {
89 fprintf(stderr,
"InitVirtualScreens : invalid geometry : %s\n", geometry);
98 0, CopyFromParent, CopyFromParent,
99 CopyFromParent, valuemask, &attributes);
104 XChangeProperty(
dpy, vs->
window, XA_WM_VIRTUALROOT, XA_STRING, 8,
105 PropModeReplace, (
unsigned char *)
"Yes", 4);
114 if(
x == 0 &&
y == 0) {
120 fprintf(stderr,
"no valid VirtualScreens found, exiting...\n");
133 Scr->rootx =
Scr->crootx + vs00->
x;
134 Scr->rooty =
Scr->crooty + vs00->
y;
136 Scr->rootx = vs00->
x;
137 Scr->rooty = vs00->
y;
139 Scr->rootw = vs00->
w;
140 Scr->rooth = vs00->
h;
141 Scr->currentvs = vs00;
149 for(vs =
Scr->vScreenList; vs != NULL; vs = vs->
next) {
151 if((
x >= vs->
x) && ((
x - vs->
x) < vs->
w) &&
152 (
y >= vs->
y) && ((
y - vs->
y) < vs->
h)) {
169 unsigned long bytesafter;
175 if(XA_WM_CTWM_VSCREENMAP == None) {
178 if(XGetWindowProperty(display, rootw, XA_WM_CTWM_VSCREENMAP, 0L, 512,
179 False, XA_STRING, &actual_type, &actual_format, &
len,
180 &bytesafter, &prop) != Success) {
187 ret = malloc(
len + 1);
188 memcpy(ret, prop,
len);
203 if(XA_WM_CTWM_VSCREENMAP == None) {
207 memset(buf, 0,
sizeof(buf));
208 for(vs = firstvs; vs; vs = vs->
next) {
222 XChangeProperty(display, rootw, XA_WM_CTWM_VSCREENMAP, XA_STRING, 8,
223 PropModeReplace, (
unsigned char *)buf, strlen(buf));
246 if(vs && tmp_win->
vs) {
295 XMapWindow(
dpy, tmp_win->
w);
326 if(icon && icon->
w) {
347 if(vs && tmp_win->
vs && tmp_win->
vs != vs) {
356 else if(tmp_win->
mapped) {
361 XUnmapWindow(
dpy, tmp_win->
w);
371 XUnmapWindow(
dpy, tmp_win->
icon->
w);
389 if(
Scr->numVscreens > 1) {
392 Window junkW,
w = tmp_win->
frame;
395 for(firstvs =
Scr->vScreenList; firstvs; firstvs = firstvs->
next)
396 if(firstvs->
x == 0 && firstvs->
y == 0) {
399 if(firstvs && firstvs != vs) {
400 tmp_win->
vs = firstvs;
void NewFontCursor(Cursor *cp, const char *str)
Window Root
Root window for the current vscreen.
VirtualScreen * vScreenList
Linked list of per-VS info.
VirtualScreen * currentvs
Currently active VS.
int frame_x
X position on screen of frame.
int frame_y
Y position on screen of frame.
Window frame
The X window for the overall frame.
void IconUp(TwmWindow *tmp_win)
void IconDown(TwmWindow *tmp_win)
bool OtpCheckConsistency(void)
void ReparentWindowAndIcon(Display *display, TwmWindow *twm_win, Window parent, int win_x, int win_y, int icon_x, int icon_y)
int ReparentWindow(Display *display, TwmWindow *twm_win, WinType wintype, Window parent, int x, int y)
Info and control for each X Screen we control.
int rootw
Copy of DisplayWidth(dpy, screen).
int rooth
Copy of DisplayHeight(dpy, screen).
Info and control for every X Window we take over.
Window w
The actual X Window handle.
struct Icon * icon
The current icon.
struct VirtualScreen * vs
Where the window is currently mapped (may be NULL).
bool mapped
Is the window mapped ?
bool icon_on
Is the icon visible.
struct VirtualScreen * parent_vs
Where the window is parented. Always set.
bool UnmapByMovingFarAway
bool isicon
Is the window an icon now ?
bool squeezed
Is the window squeezed ?
struct VirtualScreen * next
struct WorkSpaceWindow * wsw
static void init_def_vscreen(ScreenInfo *scr)
void ReparentFrameAndIcon(TwmWindow *tmp_win)
char * CtwmGetVScreenMap(Display *display, Window rootw)
void Vanish(VirtualScreen *vs, TwmWindow *tmp_win)
bool CtwmSetVScreenMap(Display *display, Window rootw, struct VirtualScreen *firstvs)
static void DisplayWinUnchecked(VirtualScreen *vs, TwmWindow *tmp_win)
void DisplayWin(VirtualScreen *vs, TwmWindow *tmp_win)
void InitVirtualScreens(ScreenInfo *scr)
int restore_mask(Window w, long restore)
long mask_out_event(Window w, long ignore_event)
void SetMapStateProp(TwmWindow *tmp_win, int state)