Commit Graph

556 Commits

Author SHA1 Message Date
Uli Schlachter fed803a6bc client manage signal: Remove startup argument
We now have awesome.startup which does the same thing in better.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 20:15:02 +01:00
Uli Schlachter 6b8bd49c0b Redraw titlebars more intelligently
Whenever a titlebar of a client needed to be refreshed, all (possibly) four
titlebars would get completely refreshed. So if someone actually added more than
one titlebar to a client, awesome would copy each titlebar's content to the
window four times. Fix this by introducing more fine-grined functions for
uploads.

This also makes awesome only update the affected area when it gets an expose
event for a titlebar instead of all four titlebars completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 15:29:11 +01:00
Uli Schlachter ef27189ffe Client: Add (and use) visualtype member to client_t objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-15 11:56:57 +01:00
Uli Schlachter 56c5797905 Finish C-side support for window shapes (FS#1051)
A drawin's and a client's bounding and clip shape can now be queried and is
returned as a cairo surface.  Also, a client window's shape (e.g. xeyes setting
its own shape) can be queried via c.shape_client_bounding and
c.shape_client_clip.  All of these properties now emit signals when changed.

(This also silently fixes a bug in luaA_drawin_set_shape_bounding() which forgot
to include the drawin's border in its size calculation)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-03 17:01:43 +01:00
Uli Schlachter 2d3103345e Implement window gravity in ConfigureRequests (FS#1137)
Previously, awesome didn't move windows when they sent a ConfigureRequest (and
it also shrunk them by the size of titlebars, before it forgot to add these).
This commit adds proper gravity support to ConfigureRequest handling.

This was tested with test-gravity from metacity (in src/wm-tester).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-04-07 11:57:40 +02:00
Uli Schlachter ee1fe4dd59 Revert "Support more than 5 mouse buttons" (FS#1082)
This reverts commit bd8158495e.

The idea was to track the current list of pressed and depressed mouse buttons,
because we get button events for more than 5 buttons, but can only query the
state of the first 5 buttons.

However, there are cases where we see button presses, but won't see the
corresponding release event. This is quite bad.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-29 16:07:13 +01:00
Uli Schlachter 23b30be106 Move size hints handling back into C (FS#1117)
Having this in lua means that size hints are only applied after the client got
resized. The bad side effect of this is some flickering if awesome is being
slow. And apparently, it is slow for way too many people...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-10 12:13:32 +01:00
Uli Schlachter bf72cf71ea Refresh focus on FocusIn events
To avoid some oddities, awesome sets the input focus lazily. Instead of
immediately sending everything to the X11 server, awesome just sets a flag "have
to update the focus later".

However, this can cause problems. As Stefan noticed, awesome can forget about
focus changes on FocusIn events when such an event comes in while we still have
a pending focus change.

The fix here is to send out the pending focus change before we record the fact
that another client now acquired the input focus.

Reported-By: Stefan Haller <haliner@googlemail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-02-11 16:19:28 +01:00
Uli Schlachter 6a39fa46c1 wibox button: Fix the x/y position in button events
The coordinates as used by X11 place (0, 0) at the top-left corner of the
window, including its border. However, this code wants the position relative to
the drawin's content, thus we also need to substract the border width.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-12-16 18:17:03 +01:00
Uli Schlachter 10d48e1fc8 Send correct geometry in ConfigureNotifies
The code was sending out ConfigureNotify events which contained the size of the
frame window. Thus, the client assumed that it is was larger than it actually
was.

Fix this by subtracting the size of the titlebars from the geometry for the
event.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-29 10:20:03 +01:00
Uli Schlachter 41ef107b88 Add titlebars on the C side
This commit makes it possible to add titlebars to a client. These titlebars are
drawables.

The drawin's input handling is moved to the drawable. This allows it to use the
same code for drawin and titlebar input handling, although there are lots of
differences between the two on the C side.

On the lua side, a new wibox.drawable module is created which handles all the
drawable-specific magic and which can also be used for titlebars.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-14 17:30:59 +02:00
Uli Schlachter 10fa808a5a Ignore (Un)Grab focus notifies
When a keyboard grab activate/deactives, the input focus jumps to the window
which does the grab. These FocusIn events sometimes managed to confuse awesome.
The symptom was that a newly mapped/started client didn't receive the input
focus:

- You press your key-combo to start a terminal. This activates a passive grab
  and the input focus jumps to the root window
- The terminal opens and the "manage" rule does client.focus = c
- This doesn't set the focus yet, but instead causes
  globalconf.focus.need_update = true and .client = new_terminal
- Before the focus is updated, the key combo is released and the focus jumps
  back to the previously focused client
- The FocusIn with mode == Ungrab causes awesome to think that the previously
  focused client got focused again and thus globalconf.client.focus gets re-set
  to what it was before
- Finally the focus is refreshed and the previously focused client gets focused

The fix is simple: We don't need the FocusIn events which are generated when a
grab activates or deactivates, so we can just ignore them.

Thanks to Majic for reporting this to me.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-08 15:41:16 +02:00
Uli Schlachter d54d3840da xerror: Print numeric infos about the error
xcb_event_get_{request,error}_label() return NULL for non-core requests and
error codes. Obviously, that's not really helpful at all, so also print the
numeric information about what failed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-15 10:02:25 +02:00
Uli Schlachter 7c7ceb1444 event: Properly ignore the "send event" flag
Thanks to muni who managed to crash his WM with conky. When conky runs in its
own window, clicking on it will sometimes (depending on the conkyrc) use
XSendEvent() to forward the event to the WM.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-19 20:20:46 +02:00
Anurag Priyam 014d191f66 keygrabber: continue grabbing till keygrabber.stop is explicitly called
Returning true from the callback just to signal keygrabber to continue grabbing
felt redundant (and silly :|).

This will break old code that relied on returning false to stop grabbing,
instead of calling keygrabber.stop.

And fix keygrabber docs.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-02-29 20:46:42 +01:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Uli Schlachter bd8158495e Support more than 5 mouse buttons
X11 only let's you query the state of mouse button 1 to 5. However, it can
generate ButtonPress and ButtonRelease events for up to 256 mouse buttons.

Instead of asking the server which buttons are pressed, we will now remember
the button state from those ButtonPress and ButtonRelease events. Currently
this let's us keep track of up to 32 mouse buttons.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-20 15:39:49 +02:00
Arnaud Fontaine be7fda45d8 Update the code following release of xcb-util 0.3.8.
xcb-util is now split into several repositories since 0.3.8. This
release also cleaned up the API a lot, thus update the code
accordingly.

Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-05-10 18:27:39 +02:00
Uli Schlachter af5e5e8e9c Remove a useless function argument
Both client_isvisible() and client_maybevisible() where almost exclusively
called with the client's screen as their second argument. Remove this second
argument and let these functions instead always act on the client's screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 20:07:14 +02:00
Uli Schlachter eff4474c6d Move size-hints handling to lua
The C core now completely ignores size hints and let's lua handle them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-11 17:21:00 +01:00
Uli Schlachter e55ed50b89 Fix an unbalanced lua stack
event_button_callback() pops the top element from the stack, but
event_emit_button() doesn't. This got was expecting both to pop the top from the
stack so Bad Things(tm) happen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 13:32:47 +02:00
Uli Schlachter af8fd15a8f client_unmanage(): Handle destroyed windows
When we receive a DestroyNotify, we have to unmanage the client. However, we
were just informed that the window was destroyed, so it doesn't make sense to
try to do "something" with the window.

This commits fixes some errors from the X server (which we ignored, but still
they are gone now).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 12:05:43 +02:00
Uli Schlachter 18799f32f8 Emit mouse::move signals when we get a motionnotify
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:44:22 +02:00
Uli Schlachter 742c0dead0 Systray: Fix
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:38:44 +02:00
Uli Schlachter 5f5787d97b Wibox: Rename to drawin
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:36:02 +02:00
Uli Schlachter d213f19c5f Widgets: Remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:27:21 +02:00
Uli Schlachter a924a92e07 Add button::{press,release} signals to windows
These signals also contain the x and y coordinate of the event which the
capi.button()-based signals can't provide.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 10:53:05 +02:00
Uli Schlachter 3aee846869 Error handling: Use libxcb's defines
Since libxcb-event is deprecated, we should stop using its defines.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-15 21:30:45 +02:00
Uli Schlachter 5d35771673 Save the screen in globalconf.
There can only be on xcb_screen_t now, so we can save it in globalconf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-16 14:10:58 +02:00
Uli Schlachter 32d9a5b2ab Remove support for zaphod mode
This makes awesome support only a single X11 protocol screen. If you are still
using zaphod mode, you can run multiple instances of awesome on the single
screens, e.g.:

DISPLAY=:1.0 awesome & DISPLAY=:1.1 awesome &

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-16 13:47:40 +02:00
Uli Schlachter ec63afc822 Track the last timestamp received from the server
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 14:37:39 +02:00
Uli Schlachter 7e03e3b796 Revert "Ignore all UnmapNotifies due to the root window"
This reverts commit 0682499895.

We have to handle all the UnmapNotifies due to ICCCM. The bug this was trying to
fix is now fixed by 9ab8cd4039 ("Set our event
mask on the root window later") instead.
2010-08-11 11:58:56 +02:00
Uli Schlachter e59086f2bf Ignore all reparents to the root window
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-11 11:56:47 +02:00
Uli Schlachter 0682499895 Ignore all UnmapNotifies due to the root window
We got XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY on the root window, but we also have
XCB_EVENT_MASK_STRUCTURE_NOTIFY on the individual client windows. Since we are
reparenting our windows, we can safely ignore all UnmapNotifies that we get
through the root window.

This fixes a bug if there were any windows already present before awesome
started. Those were obviously already mapped which means that ReparentWindow
would cause an UnmapNotify for them on the root window. This commit makes us
ignore that UnmapNotify and thus not throwing away the window immediately again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 13:30:46 +02:00
Uli Schlachter 1f36a3d4de Obey ICCCM 4.1.5 / 4.2.3
When a window is moved, it should be sent a synthetic ConfigureNotify describing
its new position. This also documents why we send a synthetic event if nothing
was changed in response to a ConfigureRequest.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:50 +02:00
Uli Schlachter a311ab0679 Don't destroy client windows in unmanage
When a client is unmanaged, we destroy our frame window. But since the client's
own window was still a child of the frame window, it was destroyed, too. This
commit fixes this by reparenting the client's window back to the root window
first.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:40 +02:00
Uli Schlachter 52f4581be3 Fix reparentnotify handling
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:36 +02:00
Uli Schlachter eb89467896 Unmanage clients on UnmapNotifies
ICCCM mandates that window managers have to trigger the conversion to withdrawn
state on the synthetic and the real unmap notify, no matter if any is missing.
Previously we couldn't do this, but thanks to the reparenting, we can now do
this properly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:33 +02:00
Uli Schlachter 9fbdecf26c Split up client_getbywin()
This splits up client_getbywin() into two different functions. One of them finds
a client by its frame window, the other checks against the client's own window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:29 +02:00
Uli Schlachter 102063dbbd Turn this into a reparenting WM
Each window is now reparented under a window created by awesome. This window is
NOT visible, this commit should not cause any visible differences. Instead, this
is done to work around problems with X11.

The only alternative would be to ban windows by moving them offscreen which is
ugly in itself and breaks pagers. Doing it like this seems to be the better
solution.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:26 +02:00
Uli Schlachter fa5a25637d Remove some more unused function arguments
We no longer use libxcb-event, so we don't have to follow it's API any more.
This means the pointless arguments and return values can be removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 17:54:13 +02:00
Uli Schlachter 58bb601658 Stop using most of libxcb-event
Upstream removed most of the code from libxcb-event and there is no
event-related stuff left in this library. We now no longer use any of the parts
that were removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 17:35:48 +02:00
Uli Schlachter 37756c0589 Remove systray icons from the save set
This commits makes awesome remove systray windows from the save set when they
are unmapped. This happens for the same reason as with normal client windows.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-25 09:26:27 +02:00
Julien Danjou 688b9f7af0 Fix mouse::leave signal emit on widgets (FS#774)
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-09 16:09:41 +02:00
Julien Danjou 4ef5e816ec client: remove internal geometry
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:11 +02:00
Julien Danjou c94f7b6767 window: import border_width property
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:29:06 +02:00
Julien Danjou 5359e738e8 key: split resolving in keyresolv
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:28:20 +02:00
Julien Danjou 6a1ce5ce05 Store widgets references as wibox items
This will store the widgets references that the wibox have inside their
environment table, and not in the global registry, avoiding memory leaks.
This should fix FS#771.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:23:57 +02:00
Uli Schlachter 026247cf18 Handle synthetic UnmapNotify events *correctly*
Second try:

Turns out I messed up with XCB_EVENT_SENT() and had a "!" too much. The old code
already tried to cope with this, but forgot to actually unmap the window which
it just set to withdrawn state.

This time I tested the patch *again* and now I found even less bugs than on my
last try.

P.S.: I suck.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-01-06 09:40:55 +01:00
Uli Schlachter d18d51e106 Revert "Handle synthetic UnmapNotify events"
This reverts commit 8e672897cb.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-29 09:53:20 +01:00