Commit Graph

145 Commits

Author SHA1 Message Date
okan
de181a1c1f we already have ymax, so use it instead of asking X for it again.
ok oga@
2008-07-11 14:23:30 +00:00
okan
cfb9c394cb spacing, declaration lineup to be consistent throughout cwm,
readability, and a bit of knf.

ok oga@
2008-07-11 14:21:28 +00:00
okan
9280b8fb5b only cycle through visible *and* non-ignored windows.
ok oga@
2008-06-30 17:52:37 +00:00
oga
ff24dcbd56 Allow a mouse binding to hide a window, and add a default keybinding for CMS-M3,
so it's hard to press by accident, but there if you need it.

requested (in a way) and tested by johan and todd.
2008-06-25 22:44:42 +00:00
oga
553a7ea586 Support mod4 (windows key) in mouse bindings too. 2008-06-25 22:40:27 +00:00
oga
ff29a8e71a Support shift in mouse bindings. There's really no reason not to.
tested by johan@ and todd@.
2008-06-25 22:38:36 +00:00
oga
5c700f8601 Actually grab the correct mouse buttons for a window, instead of doing the
old hardcoded ones (which now can be wrong).

tested by todd@ and johan@.
2008-06-25 22:37:29 +00:00
oga
7d5d330707 Sort flags.
From Pierre Riteau, thanks!

ok okan@.
2008-06-25 01:09:09 +00:00
oga
6963c8bb7d Stop keyboard move moving the window utterly off the screen. If that
happens there's no way to get it back.  Also, stop resize making a
windows size negative or zero. X does not like that one bit.

Diff from Martynas. Ok okan@.
2008-06-25 00:52:47 +00:00
oga
cb1f8b37f8 Don't link "-lX11 -lXau -lXdmcp" twice.
From Martin Toft, thanks!
2008-06-19 02:21:30 +00:00
oga
2ece6ad4cf No need to map/unmap the window on hide/show since we already do the
same to its parent.

"makes sense" okan@.
2008-06-18 20:42:29 +00:00
oga
6bc6a1ee97 Revert previous "fix" it introduces new issues of its own.
The problem that's causing us to lose windows is that rapid hiding and
unhiding causes a backlog of X events, so we lose track of client state,
and delete cc->pwin when we should not. A proper fix will arrive when it's been
worked out.
2008-06-18 19:09:12 +00:00
okan
5cf4e1c7ef missed one mouse function
noticed by oga
2008-06-17 23:46:49 +00:00
oga
81e6cb3e95 Ignore caps lock and numlock for keyboard bindings. The way Xlib makes
you do this is ugly. Also remove mod2 (numlock) and mod3 (odd) from the
list of keybinding modifiers. They don't make much sense here.

based on a heavily modified diff from Martynas.

ok okan.
2008-06-17 23:40:33 +00:00
oga
812ce180c5 Just rework the mouse binding calculation on event to look like the
kbfunc one.  Makes the code a lot easier to read.

Fixes a bug i introduced in the last commit here.

ok okan.
2008-06-17 20:55:48 +00:00
oga
34c24fdb68 The mousebinding code missing a break once it had found the correct
binding, this expose another issue that's still being debugged.
Issue pointed out by Dan Harnett, thanks!

While i'm here KNF and rework the logic to not be ass-backwards.

ok okan.
2008-06-17 20:21:17 +00:00
mk
3d8c29aa2b Make this not crash when compiled with -g.
Found by myself, analysis by kurt@, fix by me with input from otto.

``Just get some fix in...'' deraadt
2008-06-16 19:09:48 +00:00
oga
4ef73665d3 Rip out and burn the HASH_* stuff. We don't need a SPLAY tree for one font.
makes the code a lot simpler. While here rearrange the font handling functions
to be less shit.

ok and help okan@.
2008-06-15 02:47:46 +00:00
okan
b3cbe6ba11 (mostly) proper xshape event support
ok oga@
2008-06-14 22:04:11 +00:00
okan
a880cefb2e unbreak 2008-06-14 21:59:09 +00:00
okan
b48fb0f64d slightly alter the semantics of config files:
- if no config file, continue silently and apply defaults
 - if config file, parse and move on
 - if config file specified but not found, error out

ok oga@
2008-06-14 21:51:00 +00:00
okan
4a6468a264 confable menu and window mouse bindings from rivo nurges (thanks!) with
some minor fixups, man page bits and knf.

ok oga@
2008-06-14 21:48:54 +00:00
okan
7a45a93574 finally document functions that can be bound, removing the need to have
name_to_kbfunc[] around.

feedback jmc@, ok oga@
2008-06-13 21:22:34 +00:00
oga
daf3b54725 Don't client_delete() on an Unmap event, only do that on a client delete event.
found by (among others) todd@ when you have a lot of clients and do something
that maps and umaps a lot of windows fast.

Debugged with aid of gdb, todd, okan and NULL pointers in a pizza place in
edmonton while waiting an inordinately long time for food.

ok okan@, todd@
2008-06-13 03:41:58 +00:00
okan
7b8f1156d3 kill another long gone proto 2008-06-12 19:10:56 +00:00
okan
ef151e79af remove old (moved) code
ok oga@
2008-06-12 18:55:35 +00:00
okan
ad2ae8461f instead of forcing the ptr in the middle everytime, be more 'calm'; keep
the ptr still unless it moves out-of-bounds, then just follow the edge.

brought up by todd@

ok oga@
2008-06-12 18:32:06 +00:00
okan
94f0aa5a59 place the pointer in the middle of the window after resizing with grab,
just like keyboard resize.

from Edd Barrett

ok oga@
2008-06-12 05:10:24 +00:00
okan
84aeb967ba ignore if non-zero expose events, for we could be covered by multiple
windows; merely an optimization.

ok oga@
2008-06-12 05:01:13 +00:00
okan
0d911cac19 re-work client_placecalc()
- make sure new clients sit inside the current screen
- respect 'gap' placement on new clients

ok oga@
2008-06-12 04:59:51 +00:00
okan
45b2fad725 Enter -> Return, to be consistant and correct.
found the hard way by johan and discovered by oga.

"do it" oga@
2008-06-05 14:29:01 +00:00
okan
f42ad31e00 prevent trying to exec a null char; could potentially happen with a
canceled or empty searchstr.

ok oga@
2008-06-05 04:01:37 +00:00
okan
9005249c59 actually honor termpath and lockpath if specified in cwmrc.
"now" oga@
2008-06-05 00:07:05 +00:00
okan
2abd40cbdb "Meta is a perfectly well defined concept in X (The keys bound to the
Meta_L or Meta_R keysysm).  no need to redefine it roughly there" - matthieu@
2008-06-03 21:27:47 +00:00
okan
ddd8d269ff make sure to take bwdith into account when placing a new window.
ok oga@
2008-05-23 18:57:35 +00:00
oga
6d57649414 Grab the keyboard when we initialise the menu. This stops the keyboard
shortcut code stealing our events in some cases.

"put 'er in" okan@.
2008-05-23 18:48:57 +00:00
oga
bad8c87b4a Make menu_filter handle mouse movement too. This enables the keyboard
search dialogues to be manipulated with the mouse, too. It also allows
me to shrink the codebase further by killing grab_menu().

One known issue with highlighting the first entry in a search dialogue,
that'll be fixed soonish.

ok okan@, tested by Edd Barrett and todd@.
2008-05-21 14:11:19 +00:00
oga
ca512ce795 Pull out the behaviour in grab_label and search_start into one utility
function menu_filter(). The plan is to eventually merge in grab_menu too.
Shrinks the code a fair bit.

Also, change XMaskEvent for XWindowEvent to prevent getting exposes for other
windows. This is particuarly noticable on slow machines with a LOT of xterms
(todd, you're an odd man).

ok okan@, todd@.
2008-05-20 14:50:51 +00:00
oga
f8b4088fad General cleanup.
ok okan@.
2008-05-19 18:53:09 +00:00
okan
88bce60b1c stop normalizing search input; searching and matching are still
case-insensitive.  since this was the only use of normalizing input,
simplify as well.

allows one to exec with mixed case unmatched commands.

"works for me" oga@
2008-05-19 18:07:53 +00:00
oga
e13d74cfcc Function prototypes should not have parameter names in them. These must
have been missed last time i knfed this.

ok okan.
2008-05-19 17:32:22 +00:00
okan
d07a7f737f client_cyclenext() -> client_cycle() since we now pass an arg.
removes a stray proto as well.

discussed with and ok oga@
2008-05-19 17:24:19 +00:00
oga
796006fd7f allow an autogroup value of 0 to mean no group. This means you can set
automatically "sticky" (in the traditional sense of the word) windows in
autogroup mode.

Based on an initial diff from Andrew Fresh, thanks!

ok okan@.
2008-05-19 17:13:55 +00:00
okan
7f3adeacc7 as done with cycle/rcycle, make prev/next group switching one kbfuncs
and use a flag; adjusted to match and rename to {r,}cycle.

"ok, since i came up with the same thing" oga@
2008-05-19 17:11:19 +00:00
oga
80fd601708 Use the XGrabKeyboard hack in for alt-tabbing as well. This stops the
mru getting the order messed up when gvim/xpdf et all steal key events.

While i'm here, change the logic in client_cyclenext() to use break instead
of goto, it's nicer that way.

Thirdly, instead of two different kbfuncs, just use the one and a flag.

"put your cycle diff in so I can pkg_delete gvim" okan@
2008-05-19 15:17:50 +00:00
okan
0a4376b166 finally implement keyboard binding for group toggling
idea for the
    "slightly-less-abhorrent-hack-but-a-hack-nonetheless-TM" from oga@

grab and ungrab the keyboard to get around some silly X apps that like
stealing events

ok oga@
2008-05-19 12:56:58 +00:00
okan
98aad18f7d send the correct x/y coordinates to XConfigureWindow()
fixes some windows that seem as if they don't fit; noticed by Edd Barrett.

ok oga@
2008-05-18 20:06:36 +00:00
okan
0e709156e6 remove extra calls to client_draw_border()
ok oga@
2008-05-18 20:00:16 +00:00
okan
8d2a0490e4 fix backwards logic in example; found by oga@ 2008-05-18 19:57:43 +00:00
oga
ca54149838 Fix two problems with conf_unbind():
1) it used TAILQ_FOREACH() when it's removing entrys from the list, this
   is bad.
2) We didn't free key, so there was a small memleak too.

also rework conf_bindname's logic slightly to be more simple.

ok okan@
2008-05-18 19:47:19 +00:00