Commit Graph

377 Commits

Author SHA1 Message Date
Uli Schlachter 5accf0014b textbox: Cause less memory allocations
Instead of creating a pango layout all the time (e.g. twice per redraw), we now
only create a single layout which we keep around all the time and update as
needed. Hopefully this helps a little.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-07 21:41:32 +02:00
dodo b530da1861 add set_font to wibox.widget.textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-14 22:37:44 +02:00
dodo 2f3bc619cb wibox.layout.*: add get direction method
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 12:28:41 +02:00
dodo af756bb0d1 wibox.widget.background: set foreground
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 12:28:38 +02:00
Uli Schlachter 8453d0cc4f awful.wibox: Fix for removal of screen property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 16:35:43 +02:00
Uli Schlachter 01e6e2a07b imagebox: Refuse invalid images
This makes the imagebox widget refuse images which have a zero or negative width
or height. A zero size causes problems where a division by zero results in inf
which makes various stuff fail in weird ways later on.

Additionally, cairo's "error surfaces" have a negative size. Displaying those
would cause all sorts of weird problems, too, so we better reject those.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-04 22:03:42 +01:00
dodo 9befc30a7b add pango alignment to wibox.widget.textbox
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-28 10:02:09 +01:00
Uli Schlachter d16ca829aa textbox: Verify a text when it is set
This makes the textbox pass the markup/text it is given to oopango immediately.
If it is invalid, a lua error will be thrown and the old text will still be
shown.

This fixes a bug where the whole wibox isn't redrawn when a textbox complains
about broken UTF8.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-08 13:55:36 +01:00
Uli Schlachter 3ec32306db (Try to) document the wibox constructor
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-14 21:07:04 +01:00
Uli Schlachter df116331a1 Improve wibox' API documentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-12 21:45:54 +01:00
Uli Schlachter 07bbe14d02 Wibox: Set the drawin's background color if possible
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-12-12 21:18:32 +01:00
Uli Schlachter 8882cf360a wibox: Fix mouse event handling
If you managed to press mouse button 4 exactly between two entries in the
taglist, the taglist would jump by two tags instead of just one. This is because
the mouse event was forwarded to both taglist items.

This happened because the calculation in wibox' find_widgets() was wrong. If you
have a widget at (1, 1) with a size of 1x1, then (1, 1) is the only point that
this widget covers. However, the math also included the pixels (2, 1), (1, 2)
and (2, 2) in the widget's extents. This is obviously wrong.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-30 19:56:07 +02:00
Uli Schlachter f1fd4a52a1 wibox.widget.base: Use assert() instead of error()
This means you now get a backtrace (traceback?) that helps identifying
the faulty code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-22 14:50:45 +02:00
Uli Schlachter 107ba3fefc Systray: Configure background color via beautiful
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-17 09:24:59 +02:00
Uli Schlachter 1beb274944 Wibox: Use the "refresh" signal for redrawing
Previously, we used a timer with a timeout of 0 for redrawing the wibox. I had
the visual impression that the wibox was black for a moment. With strace I was
able to measure a latency of 10ms until the wibox was finally redrawn.

This now uses the "refresh" signal. With this, we get our latency down to
something like 0.15ms which sounds a lot better. :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-15 18:57:50 +02:00
Uli Schlachter 38d4602425 margin: Accept individual margins
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-08 17:22:00 +02:00
Uli Schlachter 688b4fb628 textbox: Prefix internal variables with "_"
This makes sure that textbox.text = "foo" doesn't work at all. It was never
supposed to work anyway. Sorry that I break stuff again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 14:22:44 +02:00
Uli Schlachter 547f732b00 systray: Automatically fit into available space
Instead of having to set the systray's base size by hand, it now automatically
uses min(avail_width, avail_height) as its base size. That's way less surprising
for people.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 11:54:45 +02:00
Uli Schlachter 6b972ffde0 widgets: Add mouse::{enter,leave} signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 21:17:05 +02:00
Uli Schlachter 4af11b821c Whoops, fix wibox signals
emit_signal() already adds the object as the first argument, so we don't have to
add it ourselves.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:46:11 +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 ebcda492a1 wibox.layout.fixed: Always draw "empty" widgets
If a widget has a width/height of 0, we can safely draw it without running out
of the available space. This code checks if we got enough space after we now how
much space the next widget wants.

This fixes the systray. It has to be drawn at least once so that the C core can
set up stuff correctly. However, thanks to the systray having a width of 0, it
wasn't drawn by the layout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 19:47:34 +02:00
Uli Schlachter 1fab3aa745 wibox.layout.align: Bugfix
It didn't correctly attach to its second and third widget's widget::updated
signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 19:46:47 +02:00
Uli Schlachter 01aa7e66e6 wibox.widget.background: Use draw_widget()
Without draw_widget(), the input handling is broken.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 18:45:13 +02:00
Uli Schlachter 58bf0b0c64 wibox.layout.fixed: Fix typo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:48:50 +02:00
Uli Schlachter bddecffe97 Be compatible to oopango 1.0
Some idiot broke the API in oopango git. Work-around this by checking which
version of oopango we have.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:11:20 +02:00
Uli Schlachter 2eae7e5cf4 Import lib/wibox/, a new widget system in lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 12:42:56 +02:00