Commit Graph

945 Commits

Author SHA1 Message Date
okan
05e2523486 Use func attributes where appropriate. 2018-02-01 15:17:51 +00:00
okan
5a56fafb12 Fix wins comparison declaration since it's unsigned from XQueryTree(). 2018-01-23 16:18:59 +00:00
okan
ebf71bdff9 Generate name_to_func[] in a clean and readable fashion. 2018-01-23 16:00:21 +00:00
okan
a1afcb2881 Shrink tier[] by one after removing matchname in r1.55. 2018-01-23 13:51:39 +00:00
okan
0ddfd6d206 If the requested group number is invalid, bail but don't kill cwm. 2018-01-23 13:48:49 +00:00
okan
d6b2d66ae6 Quick fix: exit after a failed execvp in u_spawn instead; previously we did in
u_exec, but the introduction of re-exec'ing the previous invocation of cwm if
'exec_wm' failed missed the 'exec' failing path. Will likely split out as a
proper fix.

Odd behaviour reported by Ve Telko.
2018-01-08 16:21:54 +00:00
okan
c0bbe24b5b Only exec the fallback when in CWM_EXEC_WM state.
Broken quit noticed by Ve Telko.
2018-01-02 14:04:58 +00:00
okan
13cc53e0d8 Typo, from Julien Steinhauser. 2017-12-30 22:25:09 +00:00
okan
0bf4ad029c If the replacement window manager fails to start, restart the fallback (the
original invocation of cwm).
2017-12-29 20:09:19 +00:00
okan
cd4212fc60 Convert menu-exec-wm from an abritrary exec menu, into a config-based menu from
which one may configure (wm <name> <path_and_args>) (and choose) specific
window managers to replace the running one. 'wm cwm cwm' is included by
default.

No objections and seems sensible to sthen.
2017-12-29 20:03:46 +00:00
okan
73d422515c As done for buttonrelease, work specific un-cycling and un-highlighting actions
into the keyrelease event, only performing what's actually needed for each;
should result in much fewer events against keyreleases. No intended behaviour
change.

Additionally, like we do for group membership, grab the keyboard only when
required for cycling.
2017-12-29 18:50:43 +00:00
okan
ef78852268 Merge group_toggle_membership_leave into the buttonrelease event and only do
border work for a group/ungroup action.
2017-12-29 16:55:50 +00:00
okan
832edccdc9 add helper function client_show to bring together like actions for unhide/raise 2017-12-29 12:54:54 +00:00
okan
9c1762c16f Add support for re-exec'ing with SIGHUP; equivalent to the already built-in
'restart' function.
2017-12-27 18:46:18 +00:00
okan
bcdf71d022 Use poll and XNextEvent to replace XNextEvent blocking inside the x11 event
handler.
2017-12-27 17:04:35 +00:00
okan
97f922dc38 zap stray that snuck in 2017-12-22 21:30:01 +00:00
okan
9ced81cc97 Return the connection number for the display. 2017-12-22 21:27:45 +00:00
okan
3668d8b165 Fix a few comments and while here, wrap some long lines. 2017-12-22 21:21:44 +00:00
okan
a3cbca55bd Use a variable to keep track of flags for menu_filter(). 2017-12-19 19:38:43 +00:00
okan
c7619bea34 Add support for _NET_WM_STATE_SKIP_PAGER and _NET_WM_STATE_SKIP_TASKBAR; eerily
close to cwm's 'ignore'.

Roughly based on an initial diff from Walter Alejandro Iglesias, but with
support for both Atoms and without cwm-based bindings.
2017-12-19 14:30:53 +00:00
okan
2c1aed2ec8 remove duplicate ExposureMask 2017-12-15 13:13:17 +00:00
okan
7944040cd2 move variable declarations up, to match everything else 2017-12-13 15:10:17 +00:00
okan
0202b86b58 clean up after previous (noprompt removal) 2017-12-12 15:37:16 +00:00
okan
2a75b150b0 Unconditionally show prompt on menus, regardless of invocation. 2017-12-11 20:58:18 +00:00
okan
6fd1cc10d9 Original idea from Dimitris Papastamos to move windows to corners a while ago;
re-proposed by Julien Steinhauser with an updated diff. Apparently this was in
the original calmnwm.

However, expand the original idea and let clients 'snap' to edges instead,
neatly allowing key bindings that snap to adjacent edges (i.e. corners) as
well. No default bindings assigned.
2017-12-07 16:25:33 +00:00
okan
4210dba245 give command and group menus their own match callbacks 2017-12-07 16:03:10 +00:00
okan
f7999cdcf1 stash dir into conf since it'll be of use 2017-12-07 15:47:14 +00:00
okan
bf36743105 organize this a bit better 2017-12-07 15:40:54 +00:00
okan
52a26c6c07 spacing 2017-12-07 15:39:47 +00:00
okan
ca283e4b1e Revert r1.109 (Switch to XWindowEvent() pulling out events that match the mask
*and* window.) of mousefunc.c. When a client destroys itself while we are
moving or resizing it, XWindowEvent() blocks. Found the hard way by Anton
Lazarov, and Lea°hNeukirchen found the right bit to revert - thanks! Reverting
since the reason to switch from XMaskEvent was unclear.
2017-11-30 18:18:51 +00:00
okan
b853354218 Case matters for menu matching on executables; from ben@lloyd.im. 2017-09-06 14:15:13 +00:00
okan
799b66d344 Use the key names from keysymdef.h in the default key bindings list for
clarification.

from Michael Reed.
2017-07-21 15:55:37 +00:00
okan
62927feb0e remove extra parentheses 2017-07-14 18:01:46 +00:00
okan
91bf263571 Pull over the remaining re-implemented window move/resize functions and create
a wrapper so that the key and mouse based move/resize callbacks can be unified.
This has already been done with other window operations and menus.
2017-07-14 17:23:38 +00:00
okan
ea88c2222f rename one function, matching others, to help upcoming change 2017-07-12 16:56:26 +00:00
okan
71381ebde2 Replace fgetln(3) with POSIX getline(3); inspired by brynet and Ingo.
feedback and ok brynet@
2017-07-10 13:36:58 +00:00
okan
6849988066 fix a few WARNINGS (new sentence, new line and extraneous Pp macro) found with
mandoc -Tlint
2017-07-06 17:09:17 +00:00
okan
ed8a48dfa1 from src, by espie@:
no need to generate y.tab.h if nothing uses it, set YFLAGS to nothing
2017-07-06 17:01:10 +00:00
okan
942a9a421b drop obsolete comment 2017-05-09 18:43:40 +00:00
okan
ba98b33fee Alter callbacks to take a struct instead of a growing number of arguments;
greatly simplifies upcoming work.
2017-05-09 13:40:18 +00:00
okan
7aacbe28e4 Ensure clients stay within the viewable bounds on placement, even with empty
borders; based on a patch from Vadim Vygonets.
2017-05-05 14:14:19 +00:00
okan
c6ed26e240 Clean up, unify and accurately calculate edge distance with client move/resize
actions, so as to not lose windows off the edge.

inspired by diffs (and feedback) from Vadim Vygonets.
2017-05-01 12:54:55 +00:00
okan
8bbf0afc60 Switch bwidth type; unfortunately X11 is inconsistent. 2017-04-26 21:10:54 +00:00
okan
8ed62b1986 The r1.36 menuq_add() conversion did this one wrong; fix by reverting to the
original code which adds to resultentry list, as opposed to the wrong one in
menuq_add(). Fixes crash noticed by at least Rickard Gustafsson.
2017-04-25 13:40:33 +00:00
okan
591ec2708f Remove 'noresult' (and simplify) as it does nothing and makes the logic around
it needless. History doesn't show what this might have been used for in future
iterations.
2017-04-25 12:08:05 +00:00
okan
021d728d1c search_match_path() isn't supposed to return anything. 2017-04-24 15:06:11 +00:00
okan
193dcb4533 Move queue init to caller so it's only called once in a few cases. 2017-04-24 13:35:25 +00:00
okan
9edb3399b6 sort 2017-04-24 13:31:19 +00:00
okan
0b5e66ec4d Raise the previously focused window, instead of the previous window in the
cycle list; seems to match behaviour of other wm's; from Walter Alejandro
Iglesias.
2017-04-24 12:27:32 +00:00
okan
1d5e421839 For {h,v}tile, instead of keeping the master client's {h,v} geometry, expand it
to %50 of the area, then fill in the remaining space with the other clients in
the same group; from Gerrit Meyerheim.

support from ajacoutot.
2017-04-24 12:18:04 +00:00
okan
1992827992 Fix group hidden state when a client wants to be on all desktops on start;
reported by Vadim Vygonets with diff, but another approach was taken.
2017-02-10 15:00:54 +00:00
okan
d94ddf7b8f Call client_resize instead of client_move after client_placecalc since the size
may also change.

from Vadim Vygonets
2017-02-06 18:10:28 +00:00
okan
ad504d072b Typo on binding name; from Redouan Ait Mallouk. 2017-01-15 21:07:44 +00:00
okan
88785e0af3 Ensure client stays inbound on key-based resize; based on logic existing in
key-based client move; from Vadim Vygonets.
2017-01-05 21:18:20 +00:00
okan
1eaac10a9a When a window has a user or program specified position, ensure the edge of the
final position is at least viewable and warp'able by the difference of bwidth;
prevents mapping windows completely off the virtual screen.
2016-12-19 14:17:26 +00:00
okan
13e3ebc448 stray newlines 2016-12-06 21:59:33 +00:00
okan
62c01a2e19 Add search_print_text(), a default callback for mi->print in menu_filter(). While
here, normalize the remaining search_print_* argument paramters.
2016-12-06 21:54:10 +00:00
okan
dd468cc47d Consistent use of menuq_add for ssh menu. 2016-12-06 21:09:22 +00:00
okan
642c4932c1 Now that dim.{x,y} are available early, use them before requiring a
MotionNotify event.
2016-12-06 21:03:58 +00:00
okan
a623680c7e Set dim.{x,y} during client_init and update on resize, instead of
(re)calculating only when applying hints.
2016-12-06 21:00:13 +00:00
okan
382e777e16 'window-search' is spelled 'menu-window'; the former snuck in during the
conversion('menu-window' already existed and was properlly documented); found
the hard way by sthen@ while trying to convert.
2016-12-06 15:03:13 +00:00
okan
52901073ce Fold unbinding functions into one for each, key and mouse; plugs a leak when
unbinding a mouse button bound to a command.
2016-12-02 17:02:17 +00:00
okan
a5a9212293 use the correct type 2016-12-02 16:50:19 +00:00
okan
c6068df369 Tame the number of 'exec' and 'path' search_match wrappers. No functional
change now, though more can likely go later, losing the (paritally complete or
incomplete/broken) argument completion bits.
2016-12-01 20:28:19 +00:00
okan
1e51789cc3 Switch ssh menu to search_match_text; like group/window/cmd menus, use only a
substring match. The previous matching is only intended for the exec menus.
2016-12-01 18:44:09 +00:00
okan
5a905031f4 Change 'menu-window' to display all windows; then add 'menu-window-hidden' for
the previous behaviour of 'menu-window'.  'menu-window' becomes the default
binding; use 'bind-mouse "1" menu-window-hidden' to restore old behaviour for
those who prefer.

OK sthen@ (long long time ago on a different version)
2016-12-01 18:17:52 +00:00
okan
58b2eb545f Normalize bind function names, based on a few categories: window, group, menu
and pointer.

Replace 'bind' and 'mousebind' options with 'bind-key' and 'bind-mouse',
respectively, replace special 'unmap' keyword with 'unbind-key' and
'unbind-mouse', and additionally allow unbinding all with 'all' keyword.
2016-12-01 17:17:27 +00:00
okan
5c15bd8953 Use an additional check with lstat(2) when d_type is unknown.
from James McDonald via portable.
2016-11-15 18:43:09 +00:00
okan
c33b352974 revert previous; upcoming changes will hopefully deal with these more
naturally.
2016-11-15 00:22:02 +00:00
okan
706ee11014 Add a wrapper based upon xevent handlers around client move/resize for key and
mouse bindings.
2016-11-15 00:07:03 +00:00
okan
d18539103e Define callbacks, then default bindings. 2016-11-14 21:25:59 +00:00
okan
a78a724512 Reorganize for upcoming changes. 2016-11-14 19:56:05 +00:00
okan
f5f2a608ff Remove the (8) default bindings for pointer move since they conflict with
default bindings for emacs, which wins; the feature remains and can be bound to
whatever users wish with cwmrc(5).

from mpi@
2016-11-14 13:52:33 +00:00
okan
943e3e7534 Make it clear these are flags. 2016-10-24 20:44:08 +00:00
okan
b490184555 Remove duplicate check that strsubmatch() already does; while here, fix a
comment.
2016-10-24 18:57:12 +00:00
okan
6eaec44a4a Sprinkle __func__ in appropriate error messages. 2016-10-24 17:39:38 +00:00
okan
66d541d7ee Get rid of 'matchname'; it's too surprising to have the menu change during
client search as different potential str matches are cycled through. If there's
interest, the only string that doesn't exist in the listing is the window's
class - that can be added of course, but it makes the line too long imho.
2016-10-24 17:16:23 +00:00
okan
9cb17b0e3b clean up search_match_client(); no behaviour change 2016-10-22 19:16:43 +00:00
okan
4811ec0433 Refactor callbacks to take a void * so as to not try and generalize into
client_ctx in keypress and buttonpress event handlers; pass appropriate *ctx's
based on context.

While here, limit some globals, replace defines with appropriate variables and
fix some naming.
2016-10-18 17:03:30 +00:00
okan
9a3b6b7fd4 remove another unused proto 2016-10-12 16:11:15 +00:00
okan
a1a192d258 Rename 2 kbfunc to match closer to what they do 2016-10-06 14:53:52 +00:00
okan
a53fef7b1e Add an argument to the callbacks to pass the xevent context, button or
key press. This allows to remove a few hacks to duplicate functions only
for behaviour changes; now differing behaviours are pushed down to the
callback. Also will allow for previously unavailable actions to be bind-able
down the road.
2016-10-06 14:41:19 +00:00
okan
4e1d180946 Check the ptr bounds in the new client during cycling, since not all
actions do ptrsave, such as restoring client geometry; adapted from a
diff by Vadim Vygonets.
2016-10-06 14:30:05 +00:00
okan
4a70ba0924 More accurate to say 'toggle', rather than 'select', for group[n]/nogroup. 2016-10-05 14:01:23 +00:00
okan
62af7b9761 Add CM-a for 'nogroup' (CM-0 stays for now); update manpage to reflect. 2016-10-05 13:35:17 +00:00
okan
ddbad284c7 Stash wmname into conf. 2016-10-05 13:10:59 +00:00
okan
c42b7d0a28 When removing xrandr regions, ensure clients are within the bounds of
the screen; adapted from an ancient diff from Sviatoslav Chagaev. Things
in this area will likely change, but put this in so it works now and
serves as a reminder.
2016-10-04 20:15:55 +00:00
okan
a7e1d9acfc Calculate client nameqlen in client_setname(), the only place it's
needed/used.
2016-10-04 15:52:32 +00:00
okan
d592dd99f7 Turn CALMWM_NGROUPS define into variable, ngroups. 2016-10-04 15:18:20 +00:00
okan
cdbe6c3bc9 Start simplifying menu code; and in turn, remove a cursor no longer
needed.
2016-10-03 18:43:49 +00:00
okan
6889482fc7 Defaults are split between defines and conf_init(); normalize these, as
well as give 'sticky' groups its own variable.
2016-10-03 14:42:34 +00:00
okan
dcdbf54e85 For both kb and mouse move, it is possible to grab a client and move it
completely off the screen/region; instead, if the pointer is outside of
the client bounds, warp the pointer to the closest edge before moving.
2016-10-03 13:52:17 +00:00
okan
3881d6ad85 client_ptrwarp should not deal with unhiding or raising clients (non ptr
requests); most callers do this already - deal with the few that do not.
client_ptrwarp becomes a simple wrapper (setpos) but it will be expanded.
2016-10-03 13:41:30 +00:00
okan
679d00b4fa remove unused proto 2016-09-30 21:44:51 +00:00
okan
5a1d71fd93 Set the initial ptr position during client init, instead of waiting
until (maybe) a ptrwarp call. Likewise, explicitly ensure an inbounds ptr
position (same as initial) when saving.
2016-09-30 20:55:54 +00:00
okan
54cccf114b Use instinsic X11 functions for key/btn/ptr grab/ungrab/regrab requests;
the one line wrappers provided no value and limited altering calls where
needed; additionally, most of them had but one caller.
2016-09-30 18:28:06 +00:00
okan
e49083a483 Replace mousefunc_sweep_draw() with a generic menu_windraw() using va
lists; use it appropriately for both window dimension and position in
the respective mousefunc calls.

ok bryent@
2016-09-30 15:12:19 +00:00
okan
e30959f62f Switch to XWindowEvent() pulling out events that match the mask *and*
window.
2016-09-30 15:05:02 +00:00
okan
035ba40ddc no need to unmap menu window again 2016-09-29 00:30:40 +00:00
okan
1b369f6063 Mechanical change: move screen menu bits to their own struct. 2016-09-29 00:21:55 +00:00