Commit Graph

5402 Commits

Author SHA1 Message Date
Uli Schlachter 8ea94154a6 Associate our default GC with the systray window
The window that is specified when a GC is created is used for two things. First,
it specifies which protocol screen the GC should be associated with. Second, it
specifies for which color depth the GC is valid.

Due to this second property, we have to use the systray window instead of the
root window. The systray window uses globalconf.default_depth.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-30 14:43:58 +02:00
Uli Schlachter aca253420d Make sure we set some required values on windows
All windows which use globalconf.default_depth must also have a backpixel,
borderpixel and colormap set when they are created. Without this, all these
xcb_create_window() calls would fail when globalconf.default_depth is no longer
the screen's default depth.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-30 14:43:58 +02:00
Uli Schlachter cbf9bbd66a screen_default_visual(): Move to awesome.c
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-30 14:43:58 +02:00
Uli Schlachter dfd95f1f72 Use the new defaults from globalconf
This makes all the code use the default colormap, depth and visual from
globalconf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-30 14:43:58 +02:00
Uli Schlachter eef3fdb452 Add variables for tracking some X11 defaults
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-30 14:43:54 +02:00
Uli Schlachter 06e11cd5d1 Clean up module dependencies
This removes the check for imlib2 which we no longer use. This also removes a
check for oocairo because we got that one twice for some weird reason.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 22:01:23 +02:00
Uli Schlachter ad3e965e16 Fix some broken luadoc
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 21:38:06 +02:00
Uli Schlachter db3b1fe431 Image: Remove
Everything now uses oocairo instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:36:58 +02:00
Uli Schlachter 368925beff Remove compatibility to image class
All the APIs that accept both an image and a cairo surface now only accept cairo
surfaces. Images are gone.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:35:59 +02:00
Uli Schlachter c8b93cec76 progressbar: Remove gradients
gears.color can do the same in better and they are currently broken anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:26:23 +02:00
Uli Schlachter d8dce35269 progressbar: Port to oocairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:24:36 +02:00
Uli Schlachter 048064b8ef graph: Remove gradients
They can and should now be done via gears.color instead. It was porting ever
since this was ported to oocairo anyway...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:02:03 +02:00
Uli Schlachter 6375ce4175 graph: Port to oocairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 18:57:52 +02:00
Uli Schlachter d74198b7db gears.color: Add much more sophiscated stuff
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 18:54:20 +02:00
Uli Schlachter fce09d4d42 tasklist: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:18:21 +02:00
Uli Schlachter 40aa974ac2 taglist: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:17:03 +02:00
Uli Schlachter f4d37f74d3 naughty: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:15:11 +02:00
Uli Schlachter 6f5862a2de beautiful: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:11:53 +02:00
Uli Schlachter 523661760a Layoutbox: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:10:01 +02:00
Uli Schlachter 03fd3f3146 awful.wibox: Remove unused local variables
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:08:16 +02:00
Uli Schlachter e53054553d awful.menu: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 16:06:44 +02:00
Uli Schlachter 4279c879b3 awful.widget.button: Use oocairo instead of image
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 15:57:10 +02:00
Uli Schlachter 8497e6ade2 rc.lua: Call launcher() with a string
When awful.widget.launcher() is called with a string, it interprets it as the
path to an image and tries to load it. So why should we do the work of calling
image() ourselves if it can be done for us? ;)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:26:09 +02:00
Uli Schlachter 36924247ca client: Use a surface for c:get_content()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:19:30 +02:00
Uli Schlachter 146a5dd67c Convert a client's icon to a cairo surface
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:18:35 +02:00
Uli Schlachter 8fbffcd2fb Turn a wibox' bg_image into a cairo surface
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:16:54 +02:00
Uli Schlachter 6dfaa0fd76 Convert the textbox's bg_image to cairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:13:58 +02:00
Uli Schlachter 1cf0dc1148 imagebox: Use the functions from the image class
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:10:06 +02:00
Uli Schlachter 3122ac649a Image: Add functions for converting to surfaces
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:09:40 +02:00
Uli Schlachter f97f605fe0 Switch imagebox to use cairo surface from oocairo
For compatibility one can now set an imagebox' .image to both a cairo surface
and an image object. The image will automatically be converted into a cairo
image surface.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:01:39 +02:00
Uli Schlachter 7b53a73b0f Add a function for drawing a cairo surface
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 12:36:38 +02:00
Uli Schlachter c3e0f72c56 gears.object: Import
This implements objects in lua. Objects provide the signal functions that are
known from the C API ({dis,}connect_signal(), emit_signal(), add_signal()).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 16:23:00 +02:00
Uli Schlachter b75ada22d8 gears.sort: Import
The difference to table.sort() is that this is guranteed to be stable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 16:09:40 +02:00
Uli Schlachter 51068f5cdf naughty: Set the window type to "notification"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:14:27 +02:00
Uli Schlachter 5f90e92f09 awful.menu: Set the window type to "popup_menu"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:13:14 +02:00
Uli Schlachter 9a8177e457 awful.wibox: Set the window type to "dock".
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:09:19 +02:00
Uli Schlachter b6fa779972 Wibox type: Make this work correctly
The last commit caused some lua errors and reading a wibox' type property
didn't work. This should all be fixed now.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:07:31 +02:00
Uli Schlachter 787bdbe468 Work around for luadoc bugs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 11:12:02 +02:00
Uli Schlachter 50c8377482 Wibox: Add window type property
This adds a "type" property that makes it possible to set the window type
as specified in EWMH.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-27 22:07:49 +02:00
Uli Schlachter acc0ca624b Move window type from client_t to window_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-27 21:52:18 +02:00
Uli Schlachter 5b96d66634 client.content: Use p_new() instead of p_alloca() (FS#824)
alloca() allocates stack space. The image that we were producing is possibly
huge which means that we were asking for e.g. 9MiB of stack space. This is not
really a good idea and caused crashes.

Fix this by using heap memory instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-27 11:25:20 +02:00
Roman Kosenko dd656f514a Fix image cropping/enlarging
Function imlib_create_cropped_image() from imlib2 doesn't initialize
buffer for new image, so if we use crop bounds bigger than original ones
we need to erase garbage from derived image.
This bug produced colorful pressed buttons (FS#516, FS#822).

Signed-off-by: Roman Kosenko <madkite@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-27 11:13:25 +02:00
Uli Schlachter 825efd21b3 Naughty: Add a missing "local"
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-18 16:34:31 +02:00
Uli Schlachter 87d869fdeb Delete the randr version reply
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-18 16:01:44 +02:00
Uli Schlachter 49b4573bc8 awful.widget: Stop using named colors
Those were removed a while ago already.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-18 12:27:09 +02:00
Uli Schlachter 8701295e6c Track the number of objects
With this patch, we track the number of objects that are alive for any class.
This information can be accessed via class.instances()

For example:

  print("wiboxes", wibox.instances())
  print("widgets", widget.instances())

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-17 17:39:41 +02:00
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