Commit Graph

5206 Commits

Author SHA1 Message Date
Uli Schlachter a311ab0679 Don't destroy client windows in unmanage
When a client is unmanaged, we destroy our frame window. But since the client's
own window was still a child of the frame window, it was destroyed, too. This
commit fixes this by reparenting the client's window back to the root window
first.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:40 +02:00
Uli Schlachter 52f4581be3 Fix reparentnotify handling
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:36 +02:00
Uli Schlachter eb89467896 Unmanage clients on UnmapNotifies
ICCCM mandates that window managers have to trigger the conversion to withdrawn
state on the synthetic and the real unmap notify, no matter if any is missing.
Previously we couldn't do this, but thanks to the reparenting, we can now do
this properly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:33 +02:00
Uli Schlachter 9fbdecf26c Split up client_getbywin()
This splits up client_getbywin() into two different functions. One of them finds
a client by its frame window, the other checks against the client's own window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:29 +02:00
Uli Schlachter 102063dbbd Turn this into a reparenting WM
Each window is now reparented under a window created by awesome. This window is
NOT visible, this commit should not cause any visible differences. Instead, this
is done to work around problems with X11.

The only alternative would be to ban windows by moving them offscreen which is
ugly in itself and breaks pagers. Doing it like this seems to be the better
solution.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 11:56:26 +02:00
Gregor Best 5d0a81c8bf fix some deprecated atom constants
Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 21:43:23 +02:00
Uli Schlachter 1d95153286 Remove all uses of attribute "unused"
Awesome is built with -Wno-unused-parameter which means there is no point in
explicitly marking arguments as unused.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 18:19:15 +02:00
Uli Schlachter 4545c23658 Brown paper bag commit
I removed the function, but forgot to remove the prototype. Whoops!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 18:06:47 +02:00
Uli Schlachter fa5a25637d Remove some more unused function arguments
We no longer use libxcb-event, so we don't have to follow it's API any more.
This means the pointless arguments and return values can be removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 17:54:13 +02:00
Uli Schlachter 58bb601658 Stop using most of libxcb-event
Upstream removed most of the code from libxcb-event and there is no
event-related stuff left in this library. We now no longer use any of the parts
that were removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 17:35:48 +02:00
Uli Schlachter 0262e39609 Remove some unused function arguments
We no longer have to follow libxcb-property's API for these function, so we can
remove arguments which we don't use anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 16:54:36 +02:00
Uli Schlachter b64c989963 Stop using libxcb-property
libxcb-property will be dropped from xcb-utils in the next release, because
upstream thinks it's not really useful and well-designed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 16:45:56 +02:00
Uli Schlachter c20e88fdce Avoid some round-trips on startup
This makes awesome prefetch some of the data it needs during startup to avoid
some useless round-trips to the server.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-07 13:31:20 +02:00
Uli Schlachter fae5dfcd08 Naughty: Handle invalid UTF-8 more sanely
Previously, if setting the textbox's text failed this caused more problems later
on. This commit makes sure that an invalid text never breaks pango.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-06 19:53:34 +02:00
Konstantin Stepanov 842dfc3064 stack graph mode works with max_value
Signed-off-by: Konstantin Stepanov <kstep@p-nut.info>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-05 14:28:14 +02:00
Uli Schlachter da2a7aec0d Fix an unbalanced lua stack operation
ewmh_process_state_atom() does a luaA_object_push() at its beginning, but it
doesn't pop that object again. Fix this by, well, popping the object at the end
of the function again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-03 11:25:54 +02:00
Ignas Anikevicius (gns_ank) e6a2bf7220 Functionality for deleting a tag using awful.tag.
tag.delete(t, fb):
    Delete tags if certain criteria are met:
        - There are no clients assigned exclusively to this tag.
        - Stickied clients have somewhere to go, 'fb' the fallback tag

    If after deleting there is no tag selected then try and
    history.restore() or select the first tag on the screen.

    Return true if successful and nil otherwise.

Signed-off-by: Perry Hargrave <perry.hargrave@gmail.com>
Signed-off-by: Ignas Anikevicius <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-02 22:05:58 +02:00
Uli Schlachter e438e3aec9 Stack clients without causing X11 errors
Previously, the bottom-most window in the stacking order would cause an error
because we tried to stack it above it's sibling XCB_NONE. This was invalid. That
X11 error didn't hurt, but it does look weird. Fix this by not issuing that
invalid ConfigureWindow request.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-02 20:09:10 +02:00
Uli Schlachter 37756c0589 Remove systray icons from the save set
This commits makes awesome remove systray windows from the save set when they
are unmapped. This happens for the same reason as with normal client windows.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-25 09:26:27 +02:00
Uli Schlachter e773eecc03 Remove windows from the save set in unmanage
While a window is in the save set, it will automatically be made visible again
when awesome exits/dies. This makes sure that the next window manager will pick
this window up and handle it properly again.

But when a window explicitly asks not to be visible, it doesn't want to be
visible. Even if awesome dies. So we should remove the client's window from the
save set in client_unmanage.

Thanks to anrxc and his xwrits.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-24 19:44:28 +02:00
Uli Schlachter edbc3fa652 awful.placement: Honor border width
While calculating if part of the window is outside the visible region, this code
should also add the border width. (FS#684)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-24 15:29:55 +02:00
Uli Schlachter e5de0abfb4 Fix an unbalanced lua stack operation
luaA_init() left the global "package" table on the stack.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-23 16:18:14 +02:00
Uli Schlachter 634520a70a Make fullscreen stacking respect EWMH
Fullscreen windows should only get their own layer when they have the input
focus. When they are unfocused they should be treated normally (FS#560).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-23 12:22:03 +02:00
Uli Schlachter 5bfe0f69d1 Improve aspect size handling
The window is now no longer enlarged to make it fit into its aspect ratio, but
only ever made lower. This was verified with a small test app that sets a min
aspect ratio of 0.5 and max aspect ratio of 2.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:32:57 +02:00
Uli Schlachter 528747267a Fix some size hint mixups
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:02:06 +02:00
Uli Schlachter 8e5409a2cd Fix a minor ICCCM incompatibility
ICCCM says that the min size should be used for the base size if no base size is
specified. The only exception is when calculating the aspect ratio of the
window, in that case only the "real" base size may be used.

Awesome didn't do this last part before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:00:23 +02:00
Uli Schlachter a53aac0dde Minor cleanup
Or'ing into a bool feels dirty and the struct members should all be documented.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 09:25:33 +02:00
Daniel Graña f47b816996 Register systray only if systray widgets are attached. (FS#503)
Signed-off-by: Daniel Graña <dangra@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 09:24:36 +02:00
Uli Schlachter 72261c9750 Ignore size hints on fullscreen windows
If a window is fullscreen it is supposed to cover the full screen. Obeying size
hints makes no sense in this case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-21 17:48:58 +02:00
Uli Schlachter e830df6092 Screen: Only use Xrandr if it provides data
This commit makes awesome ignore the screen geometry provided by Xrandr if it
only defines a single screen. This should work around nvidia's binary driver
which only provides useful data via Xinerama.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-21 14:46:49 +02:00
Uli Schlachter 7bf1370502 Split up screen_scan()
This splits up screen_scan() into screen_scan_randr(), screen_scan_xinerama()
and screen_scan_x11(). These function try to set up screens via RANDR, Xinerama
and the classic core protcol setup.

No code in these functions was actually changed, only some indentation was
changed (and a "return true/false" added to the first two functions).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-21 14:42:45 +02:00
Uli Schlachter 37703948b3 Avoid some flickering when a new window opens
A new window is by default above all other windows. This means that when we map
it and then *later* move it to the correct place in the stacking order (thanks
to lazy restacking), the window on the top of the stack has to redraw itself.

I noticed this via naughty notifies redrawing themselves after opening a browser
window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 14:32:37 +02:00
Uli Schlachter dc9807f9e1 Add a comment to XCB_NONE for sibling
I guess it is done like this accidentally, but it actually has to be done this
way to avoid flickering.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 14:30:47 +02:00
Uli Schlachter ddedb961d3 Kick out the systray when wiping a wibox
When a wibox is destroyed or detached from a screen, it is wiped to clean up its
resources. This also includes destroying the window which is associated with the
wibox.

The problem here is that if the wibox contains the systray, the systray window
would automatically be destroyed since all childs of a window are destroyed when
said window is destroyed. To fix this, we kick out the systray window before
destroying the wibox' window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 10:08:42 +02:00
Uli Schlachter f8c9b6f704 Move wibox_systray_kickout() up
Next commit will need this function and I wanted to make it clearer that no
changes where done to this function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 09:53:45 +02:00
Uli Schlachter 5992a6929f Clear a draw_text_context_t during wipe()
This fixes a bug where pango was called with already-freed arguments because
wipe() didn't zero out those variables and a later init() failed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:52:42 +02:00
Uli Schlachter 6fa27c7b48 Naughty: Catch invalid markup in notifications
Previously, an invalid markup caused an empty popup. Since the C core now throws
a lua error on invalid markup, we have a way to notice that something is wrong.

This patch first tries to set the notification's text the same way we did
previously. If that fails, everything is escaped and the result is used as the
text for the notification.

Thanks to farhaven/Gregor Best for the initial version of this and for the
string.gsub() call I stole from him. :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:35:51 +02:00
Uli Schlachter 711d78b50c textbox: Throw a lua error on invalid markup
Idea by JD, inspired from a patch by farhaven.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:16:04 +02:00
Uli Schlachter ba518f9381 Read a textbox' text correctly
Previously, querying a textbox' .text property would return the text with all
pango markup stripped.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-16 19:10:41 +02:00
Uli Schlachter 11084c774c Handle errors in the config better
luaA_loadrc() now returns a failure when executing the config file causes an
error.
Previously it returned a success which meant the next config file wasn't tried.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-15 19:21:02 +02:00
Uli Schlachter e9c2907488 Don't manually unban all windows on exit
The last commit made sure the X server does this for us instead. No need to do
that work twice.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-14 21:37:07 +02:00
Uli Schlachter 58f79dca8a Add all managed client windows to the safe set
When an application loses its connection to the X11 server, all the windows in
its save-set are saved by reparenting them back to their closest ancestor. Also,
to they are unconditionally mapped. This second property is exactly what we
need: All windows should be in mapped state, else the next window manager which
starts up won't be managing them.

This should fix all bugs where clients where lost due to a restart, yay! :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-14 21:35:06 +02:00
Uli Schlachter 0517b0002f Don't reparent systray windows on exit
Since the last commit, systray windows will automatically be reparented by the
X11 server. This means we no longer have to do this ourselves.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-14 17:42:53 +02:00
Uli Schlachter dcf2f03881 Add systray windows to the save-set
When an X11 client disconnects from the X server, all of its windows are
destroyed. This also means that all the sub-windows of those windows are
destroyed which is not necessary what one wants to happen.

To work around this, X11 has a "save-set". All the windows that are in the
save-set are reparented to their closest ancestor when they would normally be
destroyed. This is just what this code needs. :)

(The windows in the save-set are also mapped when they are saved, dunno if this
hurts here or not)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-14 17:36:10 +02:00
Uli Schlachter 2e0ea80cb3 Tasklist: Listen to the correct signals
The tasklist shouldn't care about the tag history or new tags showing up and it
also shouldn't care about tags disappearing on other screens (on the current
screen the tasklist needs to update because the tag might have been selected).

On the other hand, the tasklist really should care about tags being selected and
unselected. This worked before because this causes changes to the focus history.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-06-22 16:45:06 +02:00
Uli Schlachter 7b65f068a1 Reorder some code for fullscreening windows
When one sets a client to fullscreen, this is what currently happens:
- lua code: c.fullscreen = true
- The C code emits request::fullscreen without having touched the client's
  fullscreen property yet (c.fullscreen is still false)
- awful.ewmh changes the client's geometry to fullscreen via c:geometry()
- This causes property::geometry to be emitted
- awful.layout reacts on this and causes the screen to be re-arranged, undoing
  the fullscreen geometry set in awful.ewmh
- The C code for c.fullscreen = true continues and actually changes the client's
  fullscreen flag

The result of this is that we get a client which thinks it is fullscreen'd
without actually being that.

Fix this by first changing the client's fullscreen property and then emitting
request::fullscreen. Same thing for maximized_{vertical,horizontal}.

Thanks to Jim Pryor for reporting this bug and helping reproducing it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-06-18 18:24:05 +02:00
Uli Schlachter 0c393c8f39 xwindow_set_state(): Use uint32_t instead of long
This function calls xcb_change_property() with format==32 which means that it is
called with a 32-bit integer. However, on 64-bit machines, sizeof(long) == 64
which means that this code did the wrong thing.

This wasn't noticed before because it only causes a real difference on
big-endian machines.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-06-16 18:16:42 +02:00
Uli Schlachter 470c2e20d0 Update the tasklist when a client's icon changes
Thanks to a pidgin-using friend for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-14 20:06:02 +02:00
Uli Schlachter 0e869b7b15 Remove invalid variable usage
There is no variable called "startup" in awful.rules.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-14 20:04:38 +02:00
Uli Schlachter e291c03982 Handle _NET_WM_DESKTOP more intelligently
This makes sure that an invalid value for this property doesn't cause the client
to have no tag at all. This should be especially useful when one uses dynamic
tags and restarts awesome which causes less tags to exist than before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-06-14 20:04:38 +02:00