33#include <X11/extensions/shape.h>
39#include "ctwm_atoms.h"
46#include "functions_defs.h"
127 cwin->colormap->refcnt++;
143 if(
cmap->refcnt == 0) {
163 if(
cevent->serial >=
Scr->cmapInfo.first_req) {
164 number_cwins =
Scr->cmapInfo.cmaps->number_cwins;
170 cwins =
Scr->cmapInfo.cmaps->cwins;
172 (
lost == -1 ||
won == -1) &&
n < number_cwins;
180 cwins[
n]->colormap->install_req ==
cevent->serial) {
224 Scr->cmapInfo.cmaps->scoreboard[
n] = 1;
239 else if(
lost != -1) {
286 Tmp_win,
new.xfocus.mode,
new.xfocus.detail);
351 fprintf(
stderr,
"HandleFocus%s(): 0x%x (0x%x, 0x%x), mode=%d, "
410 if(
Scr->SloppyFocus) {
445 (
unsigned)
Event.xcirculate.event,
446 (
unsigned)
Event.xcirculate.window,
447 Event.xcirculate.place);
450 for(vs =
Scr->vScreenList; vs; vs = vs->
next) {
457 if(
Event.xcirculate.window == twm_win->
frame) {
460 else if(twm_win->
icon &&
461 Event.xcirculate.window == twm_win->
icon->
w) {
470 Event.xcirculate.place);
551 if(
Scr->InfoWindow.mapped) {
553 Scr->InfoWindow.mapped =
false;
600 yy -= (
wy - (
Scr->EntryHeight / 2) - 2);
678 (
Scr->EntryHeight / 2) - 2);
680 yy -= (
wy - (
Scr->EntryHeight / 2) - 2);
690 else if(strlen(
keynam) == 1) {
712 switch(item->
item [0]) {
728 if(((
Scr->IgnoreCaseInMenuSelection) &&
890 if(
Event.xany.window ==
Scr->Root) {
911#ifdef EWMH_DESKTOP_ROOT
968 if(
key->keycode !=
Event.xkey.keycode ||
1001#ifdef EWMH_DESKTOP_ROOT
1004 fprintf(
stderr,
"HandleKeyPress: wt_Desktop -> C_WINDOW\n");
1027 const size_t len = strlen(
key->win_name);
1137 if(
Event.xproperty.window ==
Scr->Root) {
1140 unsigned char *
prop;
1141 switch(
Event.xproperty.state) {
1158 switch(
Event.xproperty.state) {
1164 Event.xproperty.atom)) {
1181#define MAX_NAME_LEN 200L
1183 switch(
Event.xproperty.atom) {
1270 if(icon && icon->
w) {
1328 if(icon && icon->
w &&
1360 icon->
image = image;
1393 if(icon && icon->
w &&
1458 unsigned char *
prop;
1551 &(
button.xmotion.x_root),
1552 &(
button.xmotion.y_root),
1601 if(
Event.xexpose.count != 0) {
1605 if(
Event.xany.window ==
Scr->InfoWindow.win &&
Scr->InfoWindow.mapped) {
1621 !
Scr->NoIconTitlebar &&
1631 int nb =
Scr->TBInfo.nleft +
Scr->TBInfo.nright;
1640 if(w ==
tbw->window) {
1647 for(vs =
Scr->vScreenList; vs !=
NULL; vs = vs->
next) {
1654 if(
Tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win) {
1667 if(
Event.xany.window ==
Scr->workSpaceMgr.occupyWindow->w) {
1676 if(
Event.xany.window == iconmanagerlist->
w) {
1681 else if(
Event.xany.window == iconmanagerlist->
icon) {
1748 if(
Scr->SaveWorkspaceFocus) {
1750 for(
ws =
Scr->workSpaceMgr.workSpaceList;
ws !=
NULL;
ws =
ws->next) {
1765 int nb =
Scr->TBInfo.nleft +
Scr->TBInfo.nright;
1788 for(i = 0; i <
nb; i++) {
1856 Scr->NumAutoRaises--;
1859 Scr->NumAutoLowers--;
1894 if(
Scr->ClickToFocus ||
Scr->SloppyFocus) {
1905 (
unsigned)
Event.xcreatewindow.window);
1925 Event.xany.window =
Event.xmaprequest.window;
1966 if(
Scr->WindowMask) {
2001 if(
Scr->AutoFocusToTransients &&
2012 if(!
Scr->NoRaiseDeicon) {
2030 Scr->DoZoom =
false;
2174 0, 0, &dstx, &dsty, &
dumwin)) {
2183 Event.xunmap.window,
2220 &(
Event.xmotion.x_root), &(
Event.xmotion.y_root),
2260 if(
Scr->InfoWindow.mapped) {
2263 Scr->InfoWindow.mapped =
false;
2373 if(!
Scr->NoRaiseMove) {
2385 if(!
Scr->OpaqueMove) {
2392 if(
Scr->NumAutoRaises) {
2402 if(
Scr->NumAutoLowers) {
2424 if(
Scr->StayUpMenus) {
2477 switch(
Event.xbutton.button) {
2507 (
Event.xbutton.state & mask) == 0 &&
2518 if(
Scr->Highlight) {
2534 int x =
Event.xbutton.x_root;
2535 int y =
Event.xbutton.y_root;
2538 if(!
Scr->NoGrabServer) {
2542 int h =
Scr->TBInfo.width -
Scr->TBInfo.border;
2567 int x =
Event.xkey.x_root;
2568 int y =
Event.xkey.y_root;
2575 int h =
Scr->TBInfo.width -
Scr->TBInfo.border;
2651 if(!
Scr->OpaqueMove) {
2699 int nb =
Scr->TBInfo.nleft +
Scr->TBInfo.nright;
2705 if(
Event.xany.window ==
tbw->window) {
2735 if(
Event.xany.window ==
Scr->InfoWindow.win) {
2739 if(
Event.xany.window ==
Scr->Root) {
2750 w =
Event.xbutton.subwindow;
2781#ifdef EWMH_DESKTOP_ROOT
2783 fprintf(
stderr,
"HandleButtonPress: wt_Desktop -> C_ROOT\n");
2794 if(
Scr->ClickToFocus ||
Scr->RaiseOnClick) {
2798 if(
Scr->RaiseOnClick) {
2809 printf(
"ERROR! ERROR! ERROR! YOU SHOULD NOT BE HERE!!!\n");
2850 else if(
Event.xbutton.subwindow
2863 (
Tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win)) {
2871 if(
Scr->Highlight) {
2884 if(
Event.xany.window ==
Scr->Root) {
2896 if(
Event.xany.window != 0 &&
2902 x,
y, &
x, &
y, &win);
2904 x,
y, &
x, &
y, &win);
2906 Event.xany.window = win;
2911 if(
Event.xany.window == 0 ||
2933 if(
Event.xany.window !=
Scr->InfoWindow.win) {
2966 if((
tmp->num ==
Event.xbutton.button) &&
2985#ifdef EWMH_DESKTOP_ROOT
2988 fprintf(
stderr,
"HandleButtonPress: wt_Desktop -> C_WINDOW\n");
2997 if(
Tmp_win ==
Scr->currentvs->wsw->twm_win) {
3002 if(
Tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win) {
3005 else if(func == 0 &&
Scr->DefaultFunction.func != 0) {
3006 if(
Scr->DefaultFunction.func ==
F_MENU) {
3011 Scr->DefaultFunction.item->action :
NULL;
3045 if(
ev->xcrossing.window ==
args->w &&
3105 if(
ewp->window ==
Scr->Root) {
3112 if(!
Scr->FocusRoot) {
3121 for(vs =
Scr->vScreenList; vs !=
NULL; vs = vs->
next) {
3125 Scr->rootx =
Scr->crootx + vs->
x;
3126 Scr->rooty =
Scr->crooty + vs->
y;
3133 Scr->currentvs = vs;
3135 fprintf(
stderr,
"entering new vs : %p, 0x%lx, %d, %d, %d, %d\n",
3136 vs,
Scr->Root, vs->
x, vs->
y, vs->
w, vs->
h);
3163 &
d, &
d, (
unsigned int *)&
d);
3183 &
d, &
d, (
unsigned int *)&
d);
3210 if(
ewp->window ==
Scr->Root) {
3230 if(
Scr->ShrinkIconTitles &&
3234 if(
Scr->AutoRaiseIcons) {
3276 (
Scr->IconManagerFocus &&
3282 &
Scr->RootColormaps);
3301 if(
Scr->TitleFocus ||
3308 if(
Scr->TitleFocus &&
3314 else if(!
Scr->TitleFocus
3316 &&
Event.xcrossing.focus) {
3326 if(
Scr->BorderCursors) {
3333 if(
Event.xcrossing.focus) {
3340 if(!(
Scr->TitleFocus) &&
3479 if(
ev->xcrossing.window ==
args->w) {
3518 if(
Scr->ShrinkIconTitles &&
3536 "HandleLeaveNotify: Event.xcrossing.window %x != Tmp_win->w %x\n",
3543 fprintf(
stderr,
"HandleLeaveNotify: cursor_valid = false\n");
3554 "HandleLeaveNotify: cursor_valid = true; x = %d (%d-%d), y = %d (%d-%d)\n",
3644 if(
Event.xcrossing.focus) {
3683 int x,
y, width, height,
bw;
3690 if(
cre->value_mask &
CWX) {
3693 if(
cre->value_mask &
CWY) {
3729 xwc.height =
cre->height;
3730 xwc.border_width =
cre->border_width;
3749 switch(
cre->detail) {
3793 bw =
cre->border_width;
3803 if((
cre->value_mask &
CWX)) {
3807 if((
cre->value_mask &
CWY)) {
3839 fprintf(
stderr,
"SetupFrame(x=%d, y=%d, width=%d, height=%d, bw=%d)\n",
3840 x,
y, width, height,
bw);
3885 if(
sev->window ==
Scr->icccm_Window) {
TwmWindow * AddWindow(Window w, AWType wtype, IconMgr *iconp, VirtualScreen *vs)
void set_last_window(WorkSpace *current)
void FetchWmColormapWindows(TwmWindow *tmp)
bool InstallWindowColormaps(int type, TwmWindow *tmp)
void free_cwins(TwmWindow *tmp)
void RemoveRGBColormap(Atom a)
bool InstallColormaps(int type, Colormaps *cmaps)
void UninstallRootColormap(void)
TwmColormap * CreateTwmColormap(Colormap c)
void InsertRGBColormap(Atom a, XStandardColormap *maps, int nmaps, bool replace)
bool RestartPreviousState
#define FB(fix_fore, fix_back)
void RestoreWinConfig(TwmWindow *tmp)
Put a window back where it should be if we don't (any longer) control it and reparent it back up to t...
event_proc EventHandler[256]
void HandleVisibilityNotify(void)
void HandleKeyRelease(void)
void HandleEnterNotify(void)
void HandleUnmapNotify(void)
static unsigned int set_mask_ignore(unsigned int modifier)
static void HandleFocusOut(void)
void HandleMapRequest(void)
void HandleClientMessage(void)
void HandleConfigureRequest(void)
void HandlePropertyNotify(void)
void HandleFocusChange(void)
void HandleCreateNotify(void)
static void HandleFocusIn(void)
static XEvent * LastFocusEvent(Window w, XEvent *first)
void HandleMapNotify(void)
static void flush_expose(Window w)
static void SendTakeFocusMessage(TwmWindow *tmp, Time timestamp)
void HandleDestroyNotify(void)
void HandleCirculateNotify(void)
static void remove_window_from_ring(TwmWindow *tmp)
void HandleKeyPress(void)
static void do_menu(MenuRoot *menu, Window w)
void HandleLeaveNotify(void)
void HandleButtonRelease(void)
void HandleShapeNotify(void)
void HandleButtonPress(void)
struct HLNScanArgs HLNScanArgs
static TwmWindow * ButtonWindow
void HandleColormapNotify(void)
static void do_key_menu(MenuRoot *menu, Window w)
void HandleMotionNotify(void)
struct HENScanArgs HENScanArgs
static Bool HENQueueScanner(Display *display, XEvent *ev, char *_args)
static Bool HLNQueueScanner(Display *display, XEvent *ev, char *_args)
void SynthesiseFocusOut(Window w)
void SetRaiseWindow(TwmWindow *tmp)
void SynthesiseFocusIn(Window w)
void AutoLowerWindow(TwmWindow *tmp)
void AutoPopupMaybe(TwmWindow *tmp)
void FixRootEvent(XEvent *e)
void AutoRaiseWindow(TwmWindow *tmp)
void EwmhUnmapNotify(TwmWindow *twm_win)
bool EwmhClientMessage(XClientMessageEvent *msg)
void EwmhSelectionClear(XSelectionClearEvent *sev)
int EwmhHandlePropertyNotify(XPropertyEvent *event, TwmWindow *twm_win)
void EwmhAddClientWindow(TwmWindow *new_win)
void EwmhDeleteClientWindow(TwmWindow *old_win)
void EwmhSet_NET_WM_STATE(TwmWindow *twm_win, int changes)
void EwmhSet_NET_CLIENT_LIST_STACKING(void)
void ExecuteFunction(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
void draw_info_window(void)
int frame_x
X position on screen of frame.
Window hilite_wl
Left hilite window in titlebar.
Window lolite_wl
Left lolite window in titlebar.
Window hilite_wr
Right hilite window in titlebar.
int frame_y
Y position on screen of frame.
Window frame
The X window for the overall frame.
Window lolite_wr
Right lolite window in titlebar.
int frame_bw
2d border width.
TBWindow * titlebuttons
Button windows in the titlebar.
unsigned int title_height
Height of the full title bar.
Window title_w
The title bar Window.
unsigned int frame_width
Width of frame.
Pixmap gray
Pixmap to which the border is set to when window isn't focused.
unsigned int frame_height
Height of frame.
int frame_bw3D
3d border width.
void DrawIconManagerBorder(WList *tmp, bool fill)
void RemoveIconManager(TwmWindow *tmp_win)
void ShowIconifiedIcon(TwmWindow *tmp_win)
void CurrentIconManagerEntry(WList *current)
void DrawIconManagerIconName(TwmWindow *tmp_win)
WList * AddIconManager(TwmWindow *tmp_win)
void ReleaseIconImage(Icon *icon)
void DeleteIcon(Icon *icon)
void DeleteIconsList(TwmWindow *tmp_win)
void RedoIconName(TwmWindow *win)
void ExpandIconTitle(TwmWindow *tmp_win)
void IconDown(TwmWindow *tmp_win)
void ShrinkIconTitle(TwmWindow *tmp_win)
void PaintIcon(TwmWindow *tmp_win)
int GetIconOffset(Icon *icon)
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
void OccupyHandleButtonEvent(XEvent *event)
void RemoveFromWorkSpace(char *wname, TwmWindow *twm_win)
unsigned int GetMaskFromProperty(unsigned char *_prop, unsigned long len)
void PaintOccupyWindow(void)
void AddToWorkSpace(char *wname, TwmWindow *twm_win)
void ChangeOccupation(TwmWindow *tmp_win, int newoccupation)
void OtpUnfocusWindow(TwmWindow *twm_win)
Unfocus a window.
void OtpHandleCirculateNotify(VirtualScreen *vs, TwmWindow *twm_win, WinType wintype, int place)
void OtpLower(TwmWindow *twm_win, WinType wintype)
void OtpFocusWindow(TwmWindow *twm_win)
Focus a window.
void OtpRemove(TwmWindow *twm_win, WinType wintype)
void OtpForcePlacement(TwmWindow *twm_win, int where, TwmWindow *other_win)
bool OtpIsFocusDependent(TwmWindow *twm_win)
void OtpRaise(TwmWindow *twm_win, WinType wintype)
void OtpRaiseLower(TwmWindow *twm_win, WinType wintype)
char * ctwm_wm_icon_name
Icon name from override CTWM_WM_ICON_NAME property.
char * wm_name
Name from ICCCM WM_NAME property.
char * wm_icon_name
Icon name from WM_ICON_NAME property.
char * ctwm_wm_name
Name from override CTWM_WM_NAME property.
int curs_x
Stored cursor position in the window.
int curs_y
Stored cursor position in the window.
bool cursor_valid
Whether curs_x and curs_y are usable.
Info and control for every X Window we take over.
unsigned long protocols
Which protocols this window handles.
struct TwmWindow * next
Next TwmWindow on the Screen.
bool iswspmgr
This is a workspace manager window.
bool wShaped
This window is Shape'd.
bool isiconmgr
This is an icon manager window.
XWMHints * wmhints
Window manager hints.
Window w
The actual X Window handle.
bool auto_raise
Should we auto-raise this window ?
bool stackmode
Honor stackmode requests.
bool istransient
This is a transient window.
int old_bw
Original window border width before we took it over and made our own bordering.
struct TwmWindow::_ring ring
Window ring connectivity. "
char * name
Current window name. Points into TwmWindow::names.
bool auto_lower
Should we auto-lower this window ?
struct Icon * icon
The current icon.
bool squeeze_info_copied
Should ->squeeze_info be free()'d?
int occupation
Workspaces the window is in (bitmap)
SqueezeInfo * squeeze_info
Control info for title squeezing.
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.
XClassHint class
Window class info. From XGetClassHint().
Colormaps cmaps
colormaps for this application
struct WList * iconmanagerlist
List of the icon managers the window is in.
bool forced
Has had an icon forced upon it.
struct TwmWindow::_names names
Various sources of window/icon names. "
struct TwmWindow * prev
Previous TwmWindow on the Screen.
XWindowAttributes attr
Window attributes from XGetWindowAttributes()
bool UnmapByMovingFarAway
bool isicon
Is the window an icon now ?
bool squeezed
Is the window squeezed ?
struct VirtualScreen * next
struct WorkSpaceWindow * wsw
void SetBorderCursor(TwmWindow *tmp_win, int x, int y)
void PaintTitle(TwmWindow *tmp_win)
void SetFrameShape(TwmWindow *tmp)
void PaintTitleButton(TwmWindow *tmp_win, TBWindow *tbw)
void SetupWindow(TwmWindow *tmp_win, int x, int y, int w, int h, int bw)
void PaintBorders(TwmWindow *tmp_win, bool focus)
void SetupFrame(TwmWindow *tmp_win, int x, int y, int w, int h, int bw, bool sendEvent)
void DeleteHighlightWindows(TwmWindow *tmp_win)
void Iconify(TwmWindow *tmp_win, int def_x, int def_y)
void DeIconify(TwmWindow *tmp_win)
void Squeeze(TwmWindow *tmp_win)
void SetFocusVisualAttributes(TwmWindow *tmp_win, bool focus)
void SetFocus(TwmWindow *tmp_win, Time tim)
void MoveOutline(Window root, int x, int y, int width, int height, int bw, int th)
void AutoSqueeze(TwmWindow *tmp_win)
void RemoveWindowFromRegion(TwmWindow *tmp_win)
void unzoom(TwmWindow *tmp_win)
void DoResize(int x_root, int y_root, TwmWindow *tmp_win)
void UnlinkWindowFromRing(TwmWindow *win)
#define WindowIsOnRing(win)
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)
XWMHints * munge_wmhints(TwmWindow *win, XWMHints *hints)
Perform whatever adaptations of WM_HINTS info we do.
void FreeWMPropertyString(char *prop)
bool GetWMState(Window w, int *statep, Window *iwp)
TwmWindow * GetTwmWindow(Window w)
void ConstrainByBorders(TwmWindow *twmwin, int *left, int width, int *top, int height)
void FetchWmProtocols(TwmWindow *tmp)
void SetMapStateProp(TwmWindow *tmp_win, int state)
void TryToPush(TwmWindow *tmp_win, int x, int y)
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)
void GetGravityOffsets(TwmWindow *tmp, int *xp, int *yp)
void WMapRemoveWindow(TwmWindow *win)
void WMgrHandleKeyPressEvent(VirtualScreen *vs, XEvent *event)
void WMapMapWindow(TwmWindow *win)
void WMapRaise(TwmWindow *win)
void WMgrHandleExposeEvent(VirtualScreen *vs, XEvent *event)
void WMgrHandleKeyReleaseEvent(VirtualScreen *vs, XEvent *event)
void WMgrHandleButtonEvent(VirtualScreen *vs, XEvent *event)
void GotoWorkSpaceByName(VirtualScreen *vs, const char *wname)