Commit Graph

5456 Commits

Author SHA1 Message Date
Uli Schlachter c368b84817 widget layouts: Check the number of geometries
If we called the widget layout for x widgets, but the layouts returned less
geometries than this, we silently ignored the left-over widgets. If the layouts
returned more geometries, we crashed.

Fix this by verifying that the number of widgets and the number of geometries
are equal. If they are different, we use the smaller of the two.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-17 16:08:06 +02:00
Uli Schlachter 0a7bec1dbb Correctly unref widget_nodes
While drawing the wibox, the C core builds up a list of widgets and their
associated geometry. This list consists of widget_node_t objects and is
constructed like this (This is from luaA_table2widgets()):

   widget_node_t w;
   p_clear(&w, 1);
   w.widget = luaA_object_ref_item(L, idx, -1);
   widget_node_array_append(widgets, w);

After we are done with this list of widget nodes, it is freed via
wibox_widget_node_array_wipe(). However, wibox_widget_node_array_wipe() passed
"&w" to luaA_object_unref_item() while it should have used "w.widget" (which is
what was returned from luaA_object_ref_item()). This made the unref fail and the
wibox was carrying around a reference to this widget forever. This was
effectively a memory leak.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-17 15:50:00 +02:00
Uli Schlachter 71b15d292c Fix a "table expected instead of nil" error
It seems like with lots of bad luck, the garbage collector manages to "steal"
the table with the buttons right after we decided to use it. Evil collector!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-16 19:02:15 +02:00
Uli Schlachter abf329d7d8 Wibox: Unref old widgets table
When setting a new widgets table, the wibox obviously should drop its reference
on the old widgets table.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-16 18:27:04 +02:00
Uli Schlachter 89f05c90ca {tag,task}list: Use a weak-valued table
The data table is used to map objects (clients/tags) to the buttons associated
with them. This is done so that we don't have to re-create the button objects
each time this lists are updated.

The problem was that this weak-keyed table was never cleared, because the value
had a strong reference to the key (via the button's signal):

btn:connect_signal("press", function () b:emit_signal("press", o) end)

"o" is the key in the table and btn is reachable from the value. This prevented
the garbage collection of the key. Using a weak-keyed and weak-valued table
fixes this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-16 17:28:50 +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 b0f125a664 ewmh: Use the libxcb define
WINDOW is a deprecated define which will be removed. We should be using
XCB_ATOM_WINDOW instead.

This is a follow-up to 5d0a81c8bf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-15 21:25:54 +02:00
Uli Schlachter 9b89798d2b Partly revert 9a34c4567b
Turns out there are files in themes/ which are still needed (e.g. the default
wallpaper and the layout icons).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-14 22:14:38 +02:00
Ignas Anikevicius (gns_ank) 2c1d09ebc2 Add match_any function and rule_any definition for different client matching.
Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-14 16:51:40 +02:00
Uli Schlachter 9a34c4567b Use relative paths for the titlebar icons (FS#809)
The current code used "if(MATCHES)" to decide if a path was inside the source
directory or the build directory. MATCHES uses regular expressions and so this
check failed miserably if the path contained any characters that have a special
meaning in regular expressions (e.g. "+").

Fix this by only using paths inside the build dir for the icons. All icons are
copied from the source dir to the build dir so that we can freely assume that
everything is inside the build directory.

Instead of trying to "transform" the existing paths from the source dir to the
build dir, we use "file(GLOB)"'s RELATIVE option that gives us relative path.
Together with the way "file(COPY)" interprets its arguments, that's all we need.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-13 16:36:26 +02:00
Uli Schlachter 53565f6bc3 Remove tokenize.gperf
This file isn't used since 6bb646861c, but
apparently I forgot to actually remove it. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-10 12:28:31 +02:00
Uli Schlachter 6ff0263072 Stop trying to use named colors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-10 11:31:02 +02:00
Uli Schlachter cf679c2db3 Remove named colors
The only string format for colors that we now support are #rrggbb and #rrggbbaa.
All other strings will cause errors.

Thanks to this, color_init_cookie_t can be removed. There won't be a request to
the X server for transforming named colors any more and so there won't be a
cookie. This means that color_init_reply() has to be removed, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-10 11:27:40 +02:00
Uli Schlachter 97f66c57b5 Add drawing functions that will be needed later on
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-09 16:55:03 +02:00
Uli Schlachter 9a24779425 Implement color parsing
This adds a lua module for parsing colors. Named colors like "black" aren't
supported, but #rrggbb and #rrggbbaa colors do work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-09 16:54:57 +02:00
Uli Schlachter 44f64eee58 Automatically load oocairo and oopango on startup
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-09 16:54:50 +02:00
Julien Danjou c38e326242 Revert "tag.lua: check name argument to add() is valid"
This reverts commit 6cb61939c4.
2010-09-08 10:18:21 +02:00
Uli Schlachter e77b979092 awful.placement.no_overlap: Ignore desktop clients
EWMH describes desktop windows like this:

"_NET_WM_WINDOW_TYPE_DESKTOP indicates a desktop feature. This can include a
single window containing desktop icons with the same dimensions as the screen,
allowing the desktop environment to have full control of the desktop, without
the need for proxying root window clicks."

An example for such a window is nautilus' virtual root window. Naturally, such a
window would always overlap with any given client, so awful.placement.no_overlap
just didn't do anything at all. The fix is to ignore such clients for placement
calculations.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-03 17:43:36 +02:00
Uli Schlachter 9b972842c3 xutil: Remove an unused define
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:37:10 +02:00
Uli Schlachter fc3cac5f73 position: This is unused, so remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:28:12 +02:00
Uli Schlachter 6bb646861c Stop using gperf
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:24:39 +02:00
Uli Schlachter 1f9547b4e0 common/xutil.c: Stop using a_tokenize
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:22:08 +02:00
Uli Schlachter bf3aa6d79e client: Stop using a_tokenize
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:19:01 +02:00
Uli Schlachter 8e0cdc86fd mouse: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:09:34 +02:00
Uli Schlachter f2e9767434 luaa: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:08:08 +02:00
Uli Schlachter 56fd77139e draw: Stop using a_tokenize
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:04:48 +02:00
Uli Schlachter f61dca7068 dbus: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:02:21 +02:00
Uli Schlachter f96019639d common/util.h: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:00:31 +02:00
Uli Schlachter dbe237319b widget: Completely stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 18:57:18 +02:00
Uli Schlachter 5415c5fbc4 root: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 18:55:49 +02:00
Uli Schlachter 53ac35930d screen: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 18:53:44 +02:00
Uli Schlachter a440dab39d widgets: Use strings instead of tokens
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 16:17:13 +02:00
Uli Schlachter dc883f7cef textbox: Stop using tokens for wrap and ellipsize
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 16:15:23 +02:00
Uli Schlachter eae3e5b9c4 luaclass properties: Use C strings
This modifies the lua class code to use C strings instead of the tokens
generated via gperf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 15:41:41 +02:00
Uli Schlachter 0783ee8ffb barray: Work with more compare functions
Currently, this code requires a compare functions to return either -1, 0 or 1.
Values outside of this range will result in endless loops. Fix this by using if
instead of switch() for the result of the compare function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-01 15:37:21 +02:00
Uli Schlachter e1b15b2bb8 Systray: Correctly compute extents (FS#768)
The systray bases its extents on the size of the wibox that it is contained in.
No idea how this is supposed to work when the systray doesn't get the full size,
but in a vertical wibox, using <height of wibox> * <number of icons in systray>
certainly doesn't work for computing the size.

The fix isn't hard: Check the wibox' orientation when drawing and base our
calculation on its width if its orientation is different from East.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-31 18:48:09 +02:00
immerrr a3f911cf95 awful.prompt: insert selection at cursor position
Signed-off-by: immerrr <immerrr@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-31 13:48:59 +02:00
Uli Schlachter 03e0ee53d2 Wibox: Remove shape support
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-30 10:22:50 +02:00
Uli Schlachter 932e0bfcd0 Add two more missing signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-27 21:42:14 +02:00
Uli Schlachter d5209cca1f awful.placement: Fix a mis-calculation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 21:29:34 +02:00
Uli Schlachter 1cab627d5d awful.prompt: "Fix" for multi-byte characters
If you entered a multi-byte character into a prompt and then changed your mind
and used backspace to fix the character, only the last byte of the character was
removed. Because pango is intelligent, it noticed the broken utf8 and
complained.

So far nothing new. But since 711d78b50c the textbox will throw a lua error
when it gets an invalid text (= pango complains). Throwing an unprotected lua
error in this context causes the keygrabber to be killed which stops the prompt.

Fix this by removing bytes as long as there are bytes left that can be removed.

This is FS#801.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 20:42:22 +02:00
Uli Schlachter b6c8b95e34 Convert some more code to "class signals"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:42:38 +02:00
Uli Schlachter 32d389bb48 ewmh: Stop using the "new" signal in C
As with the previous commit, signals on objects will also be emitted on the
appropriate class. This can be used for out ewmh stuff, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:36:24 +02:00
Uli Schlachter 1ce0b7915b Use signal emitions on classes
Since 3fbb5f1535 "luaobject: emit signals on class too" when a signal
is emitted on some object, it will also be emitted on the class. This means that
we don't have to connect our signals via the "new" signal anymore, but can
instead connect to the signal on the class.

(Of course, the signal on the class gets as first argument the object on which
the signal was emitted)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:31:06 +02:00
Julien Danjou b5e5d1f2a0 client: emit object signals rather than class ones
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-26 18:15:19 +02:00
Uli Schlachter 3bdd4793d7 awful.tag: Add property::icon
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:11:13 +02:00
Uli Schlachter 4b69718072 signal: Fix another "unknown signal" warning
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:07:09 +02:00
Uli Schlachter f89252962e Fix an invalid index in awful.rules
A rule like { focus = true } would cause debug::index::miss and
debug::newindex::miss to be emitted.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 17:48:00 +02:00
Uli Schlachter e0774377ca Sort all signal lists alphabetically
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 17:46:17 +02:00
Uli Schlachter 8cd4d53877 Add some signals that were previously missing
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 17:43:24 +02:00