Commit Graph

5911 Commits

Author SHA1 Message Date
Uli Schlachter efd243b6d7 event: Handle MotionNotify before ButtonPress/Release (FS#1136)
The above-mentioned bug report says that a window cannot be moved via its
titlebar if you move the move quickly while clicking.

The reason for this was awesome's "event compression": We don't handle all
MotionNotify events, because they can come in big quantities. Instead, we only
want to handle the latest one and ignore all earlier ones (the mouse isn't in
that position anymore anyway).

The problem now appears if a MotionNotify is moved across a ButtonPress event
and the ButtonPress is what should cause the window to be moved. Awesome first
handles the ButtonPress event normally and starts grabbing mouse input. Then,
our event loop feeds us with an old MotionNotify event in which the button was
not pressed yet. The code for moving clients gets a motion event in which no
mouse button is pressed, concludes that the move is done and ungrabs the mouse
again, even though the button is still physically pressed.

Fix this by making sure that MotionNotify events are never moved across
ButtonPress or ButtonRelease events. We already did this for EnterNotify and
LeaveNotify events for similar reasons.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-06 10:40:57 +02:00
Uli Schlachter db167ebe80 Revert "client: Don't move clients around across restarts (FS#1159)"
This reverts commit c3bca6ac34.

This caused problems where clients would always spawn on the top-left screen and
couldn't be moved around. This was because lua placed them on the other screen,
but when the titlebar got added, their top-left corner was moved over again.
2013-10-06 10:22:49 +02:00
Uli Schlachter c3bca6ac34 client: Don't move clients around across restarts (FS#1159)
This kind of forces every client to have a window gravity of "static".

This fixes most of the problem of clients moving around across restarts due to
the titlebar. What is left is that they move due to the border width which
should be handled in another patch. Also, another patch should make this honor
the client's actual window gravity.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 16:12:06 +02:00
Uli Schlachter 0bdaed2704 screen: Fix screen equality comparison (FS#1151)
We did some black magic which broke and was replaced with more black magic. This
now broke using screen objects as table indexes:

  $ echo 'local l, s = {}, screen[1] ; l[s] = 42 ; return l[s]' | awesome-client
  double 42
  $ echo 'local l, s = {}, screen[1] ; l[s] = 42 ; return l[screen[1]]' | awesome-client
  <no output>

Fix this by using just a single lua userdata for representing a screen object.

It would be even better if screens were allocated with lua, but that doesn't
really provide any benefits right now and would be more complicated...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 15:24:09 +02:00
Uli Schlachter ed66fda1f1 client: Ignore transient_for causing loops (FS#1124)
Lots of code assumes that it can recursively follow a client's transient_for
field until it reached an end without a transient_for client. Instead of fixing
all those places to properly handle loops, this patch just makes us ignore
WM_TRANSIENT_FOR if the property causes a loop.

This means that it can be a little random which WM_TRANSIENT_FOR property is
ignored, because it will always be the one that happens to complete the cycle. I
don't think that this is bad, because there shouldn't be any loops in the first
place.

Lots-of-kudos-to: David Mohr <david@mcbf.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 14:39:35 +02:00
David Mohr e858163a0f Revert "client: add a limit to the loop (FS#573)"
This reverts commit b8de5f2d43.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 14:17:57 +02:00
Uli Schlachter f3573dbb19 awful.client.tiled: Ignore fullscreen (etc) clients (FS#1106)
I am looking forward to the bug reports requesting awful.client.floating.set(c,
true) to also automatically un-fullscreen the client...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 12:04:16 +02:00
Uli Schlachter a6466864f9 awful.screen.focus: Don't move mouse to (0, 0) first (FS#1173)
Setting mouse.screen moves the pointer to the top left corner of that screen.
However, the very next line would then move the pointer elsewhere again. Thus,
the first one wasn't needed at all.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 11:27:35 +02:00
Uli Schlachter 4368629836 naughty: Verify image parameters coming from dbus (FS#1162)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 11:21:47 +02:00
Uli Schlachter 9b78733922 Fix possible deadlock during startup
For setting up the wallpaper, awesome needs a second connection to the X11
server (isn't SetCloseDownMode just great?).

However, it was possible to have a dead-lock with our main connection due to
this. Awesome does a GrabServer during startup so that nothing else can use the
X11 server while we set ourselves up. The server is ungrabbed right before the
lua config is read. However, nothing makes sure that this ungrab request really
is sent to the server instead of just waiting in xcb's output buffer.

The dead-lock would now happen if we try to establish a second connection to the
X11 server before the ungrab request was flushed on the main connection. The
server will wait for the ungrab on the first connection, awesome is waiting for
the second connection to be successfully established.

Fix this by making sure the UngrabServer request is flushed before parsing the
config file.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 10:01:03 +02:00
Björn Åström 8792d6a4ba wibox.layout.fixed: Fix fill space
The last widget always took up the remaining
space even though fill_space(false)
had been called on the layout.

This got broken in commit 9d333113dd.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-03 15:44:45 +02:00
Alexander Kondratev 81b5e6e54b fixed #1184. Calling movetotag method throw an error on a blank screen
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-30 12:58:50 +02:00
Uli Schlachter fd8f2e23ee screen: Make sure we always have a screen
It is possible to configure RANDR so that no outputs are available. This means
awesome would be running with zero screens which leads to all kinds of
funnyness.

Work around this by falling back to other configuration mechanisms if we get no
screens from one of them. After all, screen_scan_x11() will always be able to
add a screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 23:07:33 +02:00
Uli Schlachter 1703801728 ewmh: remove _NET_DESKTOP_GEOMETRY support
Our tag concept doesn't really fit into ewmh. Thus, we were setting this
property to a way too small value anyway (just the size of the first screen in
case of multiple screens).

Since this property is optional in ewmh, let's just drop it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 23:01:49 +02:00
Uli Schlachter 381d840a82 Use $PATH when starting $SHELL
If $SHELL is set to "bash", previously awesome failed to restart itself, because
it could not find "bash". This commit makes awesome use execlp() instead of
execl() which means that $PATH is searched if the started command does not
contain a slash and this problem is fixed.

$SHELL is specified in POSIX and it doesn't seem to require an absolute path
name.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 16:22:55 +02:00
Uli Schlachter abd8246c1b CMake: Look for both "ldoc" and "ldoc.lua"
At least debian uses "ldoc" for the binary name instead of "ldoc.lua" while
upstream seems to prefer the later...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-19 17:05:20 +02:00
Uli Schlachter aaa771f887 Switch from libXcursor to libxcb-cursor
Thanks to Michael Stapelberg, there is now a xcb-only port of libXcursor which
does everything we need. This patch switches awesome over to that new library.

Since the only reason for using XOpenDisplay() instead of xcb_connect() was so
that we can use libXcursor, we can get back to that older state again. This
means that this effectively reverts the following commits:

531f8b415c "Added initial support for Xlib cursor themes"
77243cd09a "Add x11-xcb to the pkg-config checks"
779d43fc46 "Don't let Xlib own the event queue"
03759b4847 "Fix keyboard layouts"

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-19 16:48:10 +02:00
Uli Schlachter d82342e386 awful.titlebar: Add show, hide, toggle functions
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-19 14:37:07 +02:00
Uli Schlachter bcea1aab66 Stop linking against xcb-image
Since the previous commit we don't use this library any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:12:16 +02:00
Uli Schlachter 813fb94ce8 client.content: Return a cairo xcb surface
We no longer have to turn the client's content into an image buffer "by hand".
Instead, we can just use cairo for the job.

Even more exciting, we don't need to turn this into an image buffer at all. We
can just directly return a cairo xcb surface for the client window. Depending on
how lua will use this surface, this could make it possible to avoid having to
create the image buffer at all!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:09:40 +02:00
Uli Schlachter 11bef0795a client.content: Use correct client size (FS#1150)
The size saved in c->geometry also includes the titlebars. Thus, for getting the
window content, we have to subtract this from the size.

Before this, the call to xcb_image_get() was failing with a BadMatch error,
because we were asking for an area that is outside of the actual client's
window's geometry.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:06:10 +02:00
Uli Schlachter bb304c80a3 draw: Add function for finding a visual by id
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 11:59:00 +02:00
Uli Schlachter 3edd216560 wibox: Add widget geometry cache
This commit adds and uses wibox.layout.base.fit_widget(). This function is a
wrapper for widget:fit() that caches the result and thus speeds things up.

This is necessary because some layouts call :fit() from their :fit() and :draw()
functions. Nesting such layouts means that at the widget at the tail of the
stack gets its :fit() function called quite often. If this function is not
blazingly fast, this results in noticeable slowness.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-21 12:26:47 +02:00
Uli Schlachter a0e45e878e client: Ignore "fake" string property changes
I noticed high CPU usage while using asunder. The reason was that asunder
re-sets its window name every 0.1 seconds (and awesome's drawing code is way too
slow).

A semi-fix for this is to ignore string property changes if the old and new
value for the property are equal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-01 11:48:03 +02:00
Uli Schlachter 14722aa6e4 Fix WM_CLIENT_LEADER handling
This was broken since 5d0a81c8bf. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-19 19:23:19 +02:00
Uli Schlachter 5b5dd0a198 luadoc: Clients have a leader_window, not leader_id
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-19 19:15:02 +02:00
kardan 57bec371f7 honor appended -c option for --check
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-12 22:37:39 +02:00
Uli Schlachter 0c62831eea lua: Print traceback on startup errors
We do some special magic so that we can have tracebacks on errors messages.
However, the code for parsing the rc.lua called it without this magic and thus
errors didn't have tracebacks.

This is bad, because if something goes wrong in e.g. wibox.widget.textbox, you
don't really have any clue where this error is coming from.

Fix this by adding our "print traceback on error"-magic here, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-08 13:21:14 +02:00
Uli Schlachter 14daf85fe9 awful.tooltip: Set the bg color correctly (FS#1148)
Well, whoops. There is no .bg property on wiboxes for quite a while already, it
is now a :set_bg member function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-05-13 19:27:19 +02: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 ddfd9c0e79 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-04-01 13:44:46 +02:00
Uli Schlachter 2e921d9096 Fix minor memory leak in mouse_query_pointer()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-31 18:15:25 +02:00
Uli Schlachter a7c3f10ce5 Send correct position in ConfigureNotify events (FS#1030)
This event should contain the position of the top-left corner of the client's
content area. Thus, we have to add the border width to the position.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-31 18:07:49 +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
Ross Lagerwall fc49e28025 naughty: Don't interpret markup in titles
Since only the body text of a notification may contain markup,
by combining the two together and calling set_markup(), the
title would also get interpreted as if it had markup.
This could be seen with:
$ notify-send "Title & text" "<i>body text</i>"

The unescaped & would get interpreted as broken markup and so
naughty would fall back to escaping everything which would make
the "<i>" tags be shown rather than interpreted.

So, the title must always be escaped so that it is not interpreted
as markup.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-26 10:17:51 +01:00
Uli Schlachter 8af54130d6 Fix wibox.layout.flex:fit() (FS#1126)
The flex:fit() function was calling the fit() function of the widgets it
contained with too large values, trying to hand out more space than it had
available. This resulted in more space being requested than was available and
some weird layout issues resulted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-24 22:32:53 +01:00
Emmanuel Lepage Vallee e7912fc2a8 Fix mod4+[1-9] in default rc.lua
The old code had flaws:
* If the tag chnaged screen, the code was unstable.
* If awful.tag.del was used, then it displayed an error
* If tags were added later, the keyboard shortcut were unavailable
2013-03-23 21:25:44 +01:00
Emmanuel Lepage Vallee d5a3669e96 Add support for "geometry" argument for mouse events and awful.button 2013-03-23 21:24:52 +01:00
Jo De Boeck e0a163cba0 Fix calculation of distance between clients
This fixes move by direction

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-21 15:11:35 +01:00
Emmanuel Lepage Vallee a484ef076d Allow to disable taglist icons.
This is used if the user want to use a custom drawing method.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 23:43:29 +01:00
Emmanuel Lepage Vallee 67710d0008 Add ability to set background images for empty tag
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 23:43:29 +01:00
Emmanuel Lepage Vallee e920c74fd9 Add ability to disable tasklist icons and restore ability to set bg_images
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 23:43:29 +01:00
Emmanuel Lepage Vallee 1c76560da7 Add external function for {tag,task,tab}list background image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 23:43:28 +01:00
Uli Schlachter 7a47355c99 awful.mouse: Follow C API changes
Whoops. This was broken ages ago. Thanks to Elv13 for making me notice.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 22:52:39 +01:00
Poggles ed763b9ad3 Speed up the RGBA->BGRA conversion (FS#1112)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-17 17:23:04 +01:00
Uli Schlachter 2b0398c59b awful.tag: Use sane tag index values (FS#1125)
Since commit d8a93dafa3, tags have an "index" property which decides about
the order in which they are displayed in the taglist. If a tag doesn't have this
property set, the next call to awful.tag.gettags() will fix this and "invent" an
index for this new tag.

However, if multiple tags didn't have an "index" property, gettags() would
assign all of them the same index. The following call to table.sort() would then
do random magic to these tags (remember: table.sort() is not a stable sorting
algorithm, so it is allowed to randomly swap around entries which have the same
sorting key).

Fix this by making sure that the new "index" properties are different from each
other.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-16 16:51:55 +01:00
Uli Schlachter 9d5e2a981a rc.lua: Fix titlebar button events (FS#1116)
Due to some layout changes, the client title widget is no longer assigned all
the remaining space. To work around this, we wrap the widget in a flex layout
which means that it asks for all the available space. This way, moving via the
titlebar works again.

Additionally, these button events are now also assigned to the client's icon
widget. No idea why this wasn't done before...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-14 20:14:43 +01:00
Uli Schlachter bc1507f96d Send correct size to fullscreen clients (FS#1093)
Titlebars are not visible for fullscreen clients, so it doesn't make sense to
substract the area used for the titlebar in ConfigureNotify events.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-13 21:20:13 +01:00
cdump d8a93dafa3 awful.tag: add index property for custom tag order
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-12 15:14:38 +01:00
Uli Schlachter d0ab8dc0c1 Fix ignoring size hints
The function c:geometry() should only honor size hints if this was enabled for
this client. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-12 11:33:05 +01:00