13#include "ctwm_atoms.h"
18# include "ewmh_atoms.h"
51 if(hints->width_inc == 0) {
54 if(hints->height_inc == 0) {
55 hints->height_inc = 1;
63 int right =
tmp->attr.x +
tmp->attr.width + 2 *
tmp->old_bw;
64 int bottom =
tmp->attr.y +
tmp->attr.height + 2 *
tmp->old_bw;
67 tmp->title_height + 2 *
tmp->frame_bw3D) ? 0 : 2) |
68 ((
Scr->rootw - right <
69 tmp->title_height + 2 *
tmp->frame_bw3D) ? 0 : 1)];
75 if(hints->max_width < hints->min_width) {
76 if(hints->max_width > 0) {
77 hints->min_width = hints->max_width;
79 else if(hints->min_width > 0) {
80 hints->max_width = hints->min_width;
83 hints->max_width = hints->min_width = 1;
87 if(hints->max_height < hints->min_height) {
88 if(hints->max_height > 0) {
89 hints->min_height = hints->max_height;
91 else if(hints->min_height > 0) {
92 hints->max_height = hints->min_height;
95 hints->max_height = hints->min_height = 1;
110 unsigned long flags = 0
L;
118 for(i = 0,
ap = protocols; i <
n; i++,
ap++) {
133 tmp->protocols = flags;
241 if(
Scr->StrictWinNameEncoding) {
281 "%s: Converter not found; unable to convert property %s of window ID %lx.\n",
286 "%s: Insufficient memory; unable to convert property %s of window ID %lx.\n",
291 "%s: Locale not supported; unable to convert property %s of window ID %lx.\n",
311 "%s: Encoding not STRING or COMPOUND_TEXT; unable to decode property %s of window ID %lx.\n",
381 return wattr.your_event_mask;
417 unsigned long data[2];
486 2,
Scr->DefaultC,
off,
false,
false);
488 FB(
Scr->DefaultC.fore,
Scr->DefaultC.back);
490 Scr->NormalGC,
Scr->SizeStringOffset,
499 if(
Scr->CenterFeedbackWindow) {
537 Scr->MovePackResistance) {
547 Scr->MovePackResistance) {
570 if(
Scr->BorderedLayout->horiz->len > 1) {
575 for(
t =
Scr->FirstWindow;
t !=
NULL;
t =
t->next) {
592 t->frame_width + 2 *
t->frame_bw,
593 t->frame_height + 2 *
t->frame_bw);
632 for(
t =
Scr->FirstWindow;
t !=
NULL;
t =
t->next) {
648 w =
t->frame_width + 2 *
t->frame_bw;
649 h =
t->frame_height + 2 *
t->frame_bw;
650 if(
x >=
t->frame_x + w) {
653 if(
y >=
t->frame_y + h) {
665 (
x +
Scr->MovePackResistance >
t->frame_x + w)) {
672 (
x +
winw <
t->frame_x +
Scr->MovePackResistance)) {
679 (
y +
Scr->MovePackResistance >
t->frame_y + h)) {
686 (
y +
winh <
t->frame_y +
Scr->MovePackResistance)) {
696 &
newx,
t->frame_width + 2 *
t->frame_bw,
697 &
newy,
t->frame_height + 2 *
t->frame_bw);
719 *
x = ((*
x -
Scr->BorderLeft) /
Scr->XMoveGrid) *
Scr->XMoveGrid
721 *
y = ((*
y -
Scr->BorderTop) /
Scr->YMoveGrid) *
Scr->YMoveGrid
726 *
x = (((*
x + w -
Scr->BorderLeft) /
Scr->XMoveGrid) *
727 Scr->XMoveGrid) - w +
Scr->BorderLeft;
728 *
y = ((*
y -
Scr->BorderTop) /
Scr->YMoveGrid) *
729 Scr->YMoveGrid +
Scr->BorderTop;
733 *
x = ((*
x -
Scr->BorderLeft) /
Scr->XMoveGrid) *
Scr->XMoveGrid
735 *
y = (((*
y + h -
Scr->BorderTop) /
Scr->YMoveGrid) *
Scr->YMoveGrid)
736 - h +
Scr->BorderTop;
739 *
x = (((*
x + w -
Scr->BorderLeft) /
Scr->XMoveGrid) *
740 Scr->XMoveGrid) - w +
Scr->BorderLeft;
741 *
y = (((*
y + h -
Scr->BorderTop) /
Scr->YMoveGrid) *
742 Scr->YMoveGrid) - h +
Scr->BorderTop;
761 int *top,
int height)
821 left, width, top, height);
826 int *top,
int height)
850 if(*value < border) {
851 if(
Scr->MoveOffResistance < 0 ||
852 *value > border -
Scr->MoveOffResistance) {
855 else if(
Scr->MoveOffResistance > 0 &&
857 *value = *value +
Scr->MoveOffResistance;
866 if(
Scr->MoveOffResistance < 0 ||
870 else if(
Scr->MoveOffResistance > 0 &&
872 *value = *value -
Scr->MoveOffResistance;
887 if(
t->ring.cursor_valid) {
891 fprintf(
stderr,
"WarpToWindow: cursor_valid; x == %d, y == %d\n",
x,
y);
901 if(
x >=
t->frame_width +
t->frame_bw) {
902 x =
t->frame_width +
t->frame_bw - 1;
904 if(
y < t->title_height +
t->frame_bw) {
905 y =
t->title_height +
t->frame_bw;
907 if(
y >=
t->frame_height +
t->frame_bw) {
908 y =
t->frame_height +
t->frame_bw - 1;
915 x =
t->frame_width / 2;
916 y =
t->frame_height / 2;
948 for(wlist =
Scr->workSpaceMgr.workSpaceList; wlist !=
NULL;
949 wlist = wlist->
next) {
975 "XQueryPointer: root_return=%x, child_return=%x, root_x_return=%d, root_y_return=%d, win_x_return=%d, win_y_return=%d\n",
1045 hints->input =
True;
1070 hints->input =
True;
1081 hints->input =
True;
1087 win->
group = hints->window_group;
1130 if(newname == NULL && win->names.fld != NULL) { \
1131 newname = win->names.fld; \
1209 if(
Scr->AutoPriority) {
1219 if(
Scr->AutoOccupy) {
1234 if(
Scr->use3Dtitles && !
Scr->BeNiceToColormap) {
1244 if(
Scr->use3Dborders && !
Scr->BeNiceToColormap) {
1255 if(
Scr->use3Dborders && !
Scr->BeNiceToColormap) {
1292 if(newname == NULL && win->names.fld != NULL) { \
1293 newname = win->names.fld; \
1294 win->names.icon_set = true; \
1297 TRY(ctwm_wm_icon_name)
#define DoesWmDeleteWindow
#define DoesWmSaveYourself
#define FB(fix_fore, fix_back)
void Draw3DBorder(Window w, int x, int y, int width, int height, int bw, ColorPair cp, ButtonState state, bool fill, bool forcebw)
void AutoPopupMaybe(TwmWindow *tmp)
void AutoRaiseWindow(TwmWindow *tmp)
int frame_x
X position on screen of frame.
int frame_y
Y position on screen of frame.
unsigned int name_width
width of name text
Window title_w
The title bar Window.
unsigned int frame_width
Width of frame.
unsigned int frame_height
Height of frame.
void RedoIcon(TwmWindow *win)
bool GetColorFromList(name_list *list_head, char *name, XClassHint *class, Pixel *ptr)
bool IsInList(name_list *list_head, TwmWindow *twin)
void WmgrRedoOccupation(TwmWindow *win)
void OtpRecomputePrefs(TwmWindow *twm_win)
RArea RAreaNew(int x, int y, int width, int height)
Construct an RArea from given components.
void RAreaListForeach(const RAreaList *self, bool(*func)(const RArea *cur_area, void *data), void *data)
Run a function over each RArea in an RAreaList until one returns true, allowing them a place to stash...
int RLayoutFindBottomEdge(const RLayout *self, const RArea *area)
Find the bottom of the top stripe of self that area fits into.
RArea RLayoutGetAreaAtXY(const RLayout *self, int x, int y)
Find the RArea in a RLayout that a given coordinate falls into.
int RLayoutFindRightEdge(const RLayout *self, const RArea *area)
Find the right edge of the left-most stripe of self that area fits into.
int RLayoutFindLeftEdge(const RLayout *self, const RArea *area)
Find the left edge of the right-most stripe of self that area fits into.
int RLayoutFindTopEdge(const RLayout *self, const RArea *area)
Find the top of the bottom stripe of self that area fits into.
#define SIZE_VINDENT
Internal padding in the size window.
#define SIZE_HINDENT
Internal padding in the size window.
A particular extent of space.
The layout of our display.
bool icon_set
Whether an icon name property has been set.
char * wm_name
Name from ICCCM WM_NAME property.
char * wm_icon_name
Icon name from WM_ICON_NAME property.
Info and control for every X Window we take over.
ColorPair border_tile
ColorPair for non-focused window borders.
Window w
The actual X Window handle.
bool nameChanged
Has TwmWindow::name ever changed? Used only in session saving.
char * name
Current window name. Points into TwmWindow::names.
char * icon_name
Current icon name. Points into TwmWindow::names.
XClassHint class
Window class info. From XGetClassHint().
ColorPair borderC
ColorPair for focused window borders.
ColorPair title
ColorPair for various other titlebar bits.
struct TwmWindow::_names names
Various sources of window/icon names. "
Window group
Window group, from WM hints.
void GetShadeColors(ColorPair *cp)
Try and create a 'shaded' version of a color for prettier UI.
void SetupWindow(TwmWindow *tmp_win, int x, int y, int w, int h, int bw)
void SetFocus(TwmWindow *tmp_win, Time tim)
void apply_window_icon_name(TwmWindow *win)
[Re]set and apply changes to a window's icon name.
void GetWindowSizeHints(TwmWindow *tmp)
void send_clientmessage(Window w, Atom a, Time timestamp)
bool set_window_name(TwmWindow *win)
[Re]set a window's name.
XWMHints * munge_wmhints(TwmWindow *win, XWMHints *hints)
Perform whatever adaptations of WM_HINTS info we do.
void DisplayPosition(const TwmWindow *_unused_tmp_win, int x, int y)
void FreeWMPropertyString(char *prop)
bool visible(const TwmWindow *tmp_win)
void MoveResizeSizeWindow(int x, int y, unsigned int width, unsigned int height)
bool GetWMState(Window w, int *statep, Window *iwp)
static void _tryToPack(RArea *final, const RArea *cur_win)
static bool _tryToPackVsEachMonitor(const RArea *monitor_area, void *vfinal)
TwmWindow * GetTwmWindow(Window w)
void ConstrainByBorders(TwmWindow *twmwin, int *left, int width, int *top, int height)
XWMHints * gen_synthetic_wmhints(TwmWindow *win)
int restore_mask(Window w, long restore)
bool ConstrainByLayout(RLayout *layout, int move_off_res, int *left, int width, int *top, int height)
void ConstrainByBorders1(int *left, int width, int *top, int height)
long mask_out_event_mask(Window w, long ignore_event, long curmask)
void FetchWmProtocols(TwmWindow *tmp)
long mask_out_event(Window w, long ignore_event)
void SetMapStateProp(TwmWindow *tmp_win, int state)
void TryToPush(TwmWindow *tmp_win, int x, int y)
void WarpToWindow(TwmWindow *t, bool must_raise)
void apply_window_name(TwmWindow *win)
[Re]set and apply changes to a window's name.
void TryToGrid(TwmWindow *tmp_win, int *x, int *y)
void TryToPack(TwmWindow *tmp_win, int *x, int *y)
char * GetWMPropertyString(Window w, Atom prop)
static void TryToPush_be(TwmWindow *tmp_win, int x, int y, PushDirection dir)
void GetGravityOffsets(TwmWindow *tmp, int *xp, int *yp)
bool set_window_icon_name(TwmWindow *win)
[Re]set a window's icon name.
void GotoWorkSpace(VirtualScreen *vs, WorkSpace *ws)