Commit Graph

205 Commits

Author SHA1 Message Date
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 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 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
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
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 983001613a Drawable: Improve signal behavior
When property::surface is emitted, the drawable didn't know its geometry yet,
which had weird side effects. Fix this by changing the C API a little. The
function drawable_set_surface() now no longer allows a NULL surface as its
argument.

The required changes for the titlebar code also means that we no longer throw
away the double-buffering surface when a client is moved.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-02-20 14:09:19 +01:00
Uli Schlachter ea30119410 Use glib instead of libev
This commit ports awesome from libev to the glib main loop. This means that
awesome has fewer dependencies, because we were already depending on glib before
and now no longer need glib.

However, the main reason for this change is that, thanks to lgi, we have glib
bindings for lua. This means that lua code can add all kinds of event sources to
the main loop (timeouts, fd watchers, SIGCHLD watchers, ....). Yay

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-21 21:01:12 +01:00
Jeremy Bethmont 882099f900 Fixed bounding shape size to take into account border size.
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-12 17:51:41 +01:00
Uli Schlachter 265060f1f7 Fix a bug when switching fullscreen mode
The code assumed that a window gets resized when it enters/leaves the fullscreen
mode. This was needed because the code for resizing a window hides and shows the
titlebars.

However, it is possible for a window to enter/leave fullscreen mode without
getting resized, because it already has the correct geometry. In this case,
titlebars were not handled correctly.

This commit fixes that by forcing a resize to the current geometry when the
fullscreen flag is toggled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-09 18:50:38 +01:00
Uli Schlachter c18f5f22f9 client: Re-add shape support
Same reasoning as for the recent commit which adds these to drawins.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-06 20:51:54 +01:00
Uli Schlachter dac95db79b drawin: Correctly set window shape
Thanks to "rnoway" (aka Arnaud?) for noticing my typo.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-06 20:43:05 +01:00
Uli Schlachter 37d074f881 Drawin: Re-add shape support
Commit 03e0ee53d2 removed window shapes, because at the time I was too
lazy to port them from the old image system to oocairo.

This commit re-adds them, but for now only as a way to set the shape.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-05 18:11:16 +01:00
Uli Schlachter 52d618c811 Fix fullscreen windows
Fullscreen windows only worked on a screen which had x and y coordinates 0.
Otherwise, the window inside the frame window was completely misplaced.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-04 21:35:32 +01:00
Uli Schlachter 3c320927f8 Hide titlebars on fullscreen clients
Fullscreen clients shouldn't be decorated, thus hide titlebars on those.

This commits assumes that clients get resized when they enter or leave the
fullscreen state. I don't think that this assumption is necessarily true, but
let's just wait for bug reports. :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-03 19:34:16 +01:00
Uli Schlachter e57e4a99c5 Enlarge clients when adding titlebars
Previously, the area of the window that the client could draw to got smaller
when titlebars are added. This causes all sorts of odd-looking effects, so
instead this should enlarge the window suitably.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-03 18:44:44 +01:00
Uli Schlachter 77fedaeee8 Remove unused signal property::widgets
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-31 22:24:23 +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 c6658742ff drawin: Update the drawable's geometry on move
We only need to update a drawin's drawing related resources when its size
changes. Thus, when a drawin is just moved, drawin_update_drawing() is not
called. However, this function was used for telling the drawin's drawable about
its geometry. This means that the drawable had an outdated idea about what its
geometry was.

Fix this by making sure to always call drawable_set_geometry().

Thanks to Javafant for reporting this bug on IRC.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-26 21:11:27 +02:00
Uli Schlachter 1f69f36993 Client: Properly get rid of titlebars on unmanage
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-23 10:19:10 +02:00
Uli Schlachter 8348d44444 Tags: Remove screen property
A tag's screen is now implemented purely in lua and it is no longer C's
business.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-23 10:05:34 +02:00
Uli Schlachter 1e418cbe3b drawable: Add property::surface
This new property is used for fixing some missing redraws that the old code had.
Those could be seen via awful.menu. Open and close a submenu repeatedly and the
submenu will appear black.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-20 22:51:52 +02:00
Uli Schlachter 1115457ac8 luaA_window_get_opacity: Always return a number
What's the point of distinguishing between "opacity 1" and "no opacity set"?
This commit makes awesome handle both cases identically.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-19 13:10:13 +02: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 f0512eeaab Introduce drawables
A drawable is something that you can draw to, just like a drawin. However, a
drawable isn't necessarily its own windows. This will later on be used to
implement titlebars where the titlebars are drawables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-14 17:30:54 +02:00
Tumin Alexander 531f8b415c Added initial support for Xlib cursor themes
I hope this time i got all right with git format-patch.

Signed-off-by: Tumin Alexander <iamtakingiteasy@eientei.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-07 12:39:56 +02:00
Uli Schlachter 29b09cf7da Ignore re-focusing the focused client
When something gives the input focus to the client which already has the input
focus, bad things can happen. Normally, you'd expect nothing to happen in this
case, but X11 is not that simple.

When updating the input focus and the focused client has the nofocus hint set,
we are actually taking away the focus from this client.

Hopefully this fixes FS#973.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-06 13:37:58 +02:00
Uli Schlachter fc76521edb Don't change focus in response to FocusIn events
Previously, when we received a FocusIn event, we would update the input focus,
because client_focus_update set globalconf.focus.need_update to true.

However, this is wrong for clients following the globally active focus model,
because in this case its the client which controls which window has the input
focus. It could happen that we thus took away the focus from the client which
just gave itself the focus.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-06 13:33:27 +02:00
Arvydas Sidorenko d612b922f3 lua_objlen wrapped in luaA_rawlen
In lua 5.2 lua_objlen was renamed for now reason

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 11:02:57 +02:00
Arvydas Sidorenko d61cdb86c9 Renamed luaL_reg to luaL_Reg
The original struct name is luaL_Reg, but Lua v5.1 had a
`typedef luaL_reg luaL_Reg`, which in v5.2 was removed
and as a result breaking the build in Awesome which uses luaL_reg
version exclusively.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:52:10 +02:00
Uli Schlachter e57af377bb Don't pass cairo surfaces around on the lua stack
Now that the C code uses lightuserdata for passing around cairo surfaces, they
are no longer automatically garbage collected. To avoid memleaks, this commit
compares the C code to use cairo_surface_t pointers instead of the lua stack.

This also fixes a memleak were a client's icon was leaked.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-28 09:29:47 +02:00
Uli Schlachter 4f30dfd198 Switch from oocairo to lgi.cairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-27 19:20:34 +02:00
Uli Schlachter f252746e86 Fix a harmless compiler warning
objects/client.c:678:1: warning: no previous prototype for ‘client_set_hidden’

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-05 12:13:08 +02:00
Anurag Priyam c654cfd8d2 unset hidden state when a client regains focus
This should be the expected behavior, imo.  Otherwise the client doesn't appear
in tasklist regardless of being focussed.

[Thanks Uli][1] :).

[1]: http://thread.gmane.org/gmane.comp.window-managers.awesome.devel/7096

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-05 12:09:39 +02:00
Uli Schlachter ba64f3c3cd client_focus_refresh: Always set input focus
Lua code can give the input focus to unfocusable clients. That means they have
nofocus set and they don't implement WM_TAKE_FOCUS.

Previously, the previously focused client continued getting input events in that
event. Now the last client is properly unfocused.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-04-06 12:24:34 +02:00
Uli Schlachter 20cafb4851 drawin: Remove bg_color property
The default background color (None) means that the server will leave the
window's content untouched when an exposure happens. This should get rid of all
cases of "flashing window".

The real background will later be drawn while awesome is handling the expose
event.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-23 16:54:55 +01:00
Majic 0e8fc995bb Minor readability fixes, STREQ()-like macros added
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-11-18 17:56:21 +01:00
Uli Schlachter bf76b3842b Ungrab the server before parsing the config
This moves the loading of the rc.lua and managing of pre-existing clients to
after we ungrab the server during startup. To make sure we have no races with
clients which start up parallel to awesome, we do the QueryTree for all the
clients that we have to manage before the ungrab, but start managing the clients
only after the ungrab.

This means that we have already selected our event mask on the root window in
scan() and thus received an UnmapNotify event when we reparent windows into a
frame window. This has the effect that we immediately unmanage the client again,
whoops.

To fix this, we grab the server again and remove our event mask on the root
window again while we reparent.

This should hopefully fix all cases where we deadlock during startup because
pulseaudio wants to talk to the X server, but is being ignored because we have
the server grabbed while at the same time we are waiting for pulseaudio.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-19 15:11:11 +02:00
David Palacio db1610c7dc Desktop clients may not be visible on all tags.
Usually desktop clients are on a sticky state. If the client
is not sticky, only show on selected tags.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-04 20:24:39 +02:00
Uli Schlachter e40bfedd30 drawin: Don't cause X11 errors during allocation
We were only creating an X11 window for a new drawin after we handled all the
options that were passed in. However, this means that drawin({ height = 4 })
would try to resize the window before we created a window, which caused an X11
error.

Fix this by moving our initialization before of the handling of construction
arguments.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-12 19:38:20 +02: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 2729357ad2 Fix possible crash on shutdown (FS#904)
Open some windows, select a layout which does something (=not floating) and
restart awesome. It's likely that it will crash during the shutdown.

The reason is that awesome cleans up various state before going down. This is
mostly all the lua state. However, drawin_wipe, which is called for cleaning up
after a drawin, dared to emit a sigal which then let various lua code run which
had access to objects which were already destroyed.

Various bad things can happen this way, in this situation it was a crash when an
already-destroyed client was resized.

The fix is to move the signal out of drawin_wipe. It doesn't belong there
anyway. Instead, property::workarea should be emitted when the drawin's visible
property changes as this is when the workarea changes, too (screen_area_get()
only looks at visible drawins).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-05-14 16:54:33 +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 13364a0181 Turn globalonf.drawins into the list of visible drawins
This fixes a crash when the opacity of a not-visible drawin is changed. This
happened because we got a PropertyNotify for our own change of _NET_WM_OPACITY
and then tried to set the drawin's opacity to this new value.

However, the drawin was only reachable through globalconf.drawins and wasn't
ref'd in lua.  This means that the luaA_object_push() call in
property_handle_net_wm_opacity() didn't find the drawin and instead pushed a
nil. This then later caused an unprotected lua error in window_set_opacity().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 08:29:30 +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 244d19fd0e Stop doing per-screen banning
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 20:01:05 +02:00
Uli Schlachter 08cd44dda7 drawin: Remove screen property
There isn't much point in the screen property of a drawin because the geometry
already defines on which screen the drawin is.

The biggest chunk of changes from this is due to removing the functions
drawin_detach and drawin_attach which where called when the screen property was
set/unset.

The code from drawin_detach is moved into drawin_set_visible and drawin_wipe.
drawin_attach is moved into drawin_init.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 16:21:49 +02:00
Uli Schlachter b6baca5857 Client: Only emit property::{x,y,width,height} if necessary
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-11 17:21:00 +01: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 4e31c72497 drawin: Remove some dead code
Thanks to a recent commit, a drawin's window will always be a valid and existing
window. This means we can remove all the code which checks this before doing
something.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-09 16:21:20 +01:00
Uli Schlachter 61fde273ca drawin: Update the drawing-stuff less often
We don't need an up-to-date pixmap and cairo surface for a drawin which isn't
visible. Thus, only bring those up-to-date when the drawin is visible.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-09 16:21:20 +01:00