Commit Graph

5042 Commits

Author SHA1 Message Date
Uli Schlachter 92183caad0 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:50:15 +02:00
immerrr e5d4ff6147 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:50:38 +02:00
Uli Schlachter 36b639801b awful.placement: Fix a mis-calculation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 21:15:01 +02:00
Uli Schlachter 26d97d0273 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 21:07:20 +02:00
Julien Danjou 4ea1753f34 Change codename
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 10:50:48 +02:00
Uli Schlachter c73b1c8d4e Revert "Don't call "focus" hook in client_focus()"
This reverts commit 27f9c0177a.

This commit broke code like the following because reading client.focus would
still return the previously focused client:

awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
2010-08-17 21:34:01 +02:00
Uli Schlachter 5fafe8d0eb Fixes for maximized clients
When a client is maximized and then has a titlebar added / removed, we need some
special magic to make sure it still gets the correct geometry. This is now done
by maximizing the client again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-17 20:52:32 +02:00
Uli Schlachter 6d1130b408 Ignore the titlebar geometry on fullscreen clients
When a client is fullscreen, it should cover the full screen. There's no point
in trying to do clever things if the titlebar is banned anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-17 18:06:40 +02:00
Uli Schlachter 5a51778768 Unban the titlebar when leaving fullscreen
When entering fullscreen, we remove the titlebar via titlebar_ban(). Obviously,
it makes sense to unban the titlebar again when leaving fullscreen. :)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-17 18:04:33 +02:00
Uli Schlachter 6ed3b61844 Don't call "focus" hook in client_focus()
Later on that call will be done through a FocusIn event.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-15 13:17:56 +02:00
Uli Schlachter 4862212c14 Use globalconf.timestamp
This makes us use globalconf.timestamp instead of XCB_CURRENT_TIME in the places
where it makes sense.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 14:54:12 +02:00
Uli Schlachter 5225683d9b Track the last timestamp received from the server
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 14:38:14 +02:00
Uli Schlachter b938ce00b5 Always unban a client that we are trying to focus
Previously, if a client had nofocus == true, it wasn't unminimized if sth tried
to focus it. Also, if this client had the WM_TAKE_FOCUS protocol, the focusing
would fail since it's an error to set the input focus to an unviewable window.

For consistency, this also moves the code that sets a client's minimized
property to false into client_unban() since it doesn't make sense to have a
minimized client unbanned (i.e. visible).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 14:35:03 +02:00
Uli Schlachter 0e798d0d76 Check "focusable" in awful.client.focus.filter(c)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 13:22:44 +02:00
Uli Schlachter 9d1ae71cbf Add "focusable" property to client objects
If this property is true, setting "client.focus" to this client might have some
effect. If it is false, setting "client.focus" will be ignored completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-12 13:22:37 +02:00
Uli Schlachter 6f19940020 prompt: Only show error messages
Ever since awesome.spawn() also returns the pid of the started process, the
prompt accidentally displayed the pid of processes that it started.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 14:24:52 +02:00
Uli Schlachter 8cbfd442a0 Correctly read a textbox' ellipsize and wrap properties
The old code used the wrong constants which meant we always returned "word" for
wrap and "end" for ellipsize.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 14:00:16 +02:00
Uli Schlachter ce4088bbf7 client_unmanage: Update WM_STATE later
According to ICCCM, if a client wants to reuse one of its windows, it has to
wait until the WM updated WM_STATE. This means updating WM_STATE should be the
very last thing we do when unmanaging a window.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-09 12:00:45 +02:00
Gregor Best 4d9211c8c3 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:44:43 +02:00
Uli Schlachter a2c6dde410 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:20:08 +02:00
Uli Schlachter 7b06933f5b 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:20:07 +02:00
Uli Schlachter 5e761f8c24 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:59:20 +02:00
Uli Schlachter 43bba587fb 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:57:48 +02:00
Uli Schlachter d79578c918 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:57:25 +02:00
Uli Schlachter 721f33d5cc 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:57:08 +02:00
Uli Schlachter 54ff33fb04 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:28:44 +02:00
Uli Schlachter 8d59512ccc 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:52:46 +02:00
Konstantin Stepanov 457913a0e8 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:27:41 +02:00
Uli Schlachter a77209c7fe 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:27:11 +02:00
Ignas Anikevicius (gns_ank) 402870687b 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:06:17 +02:00
Uli Schlachter cc33cd17a0 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:28:09 +02:00
Uli Schlachter db958cafb4 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:46:23 +02:00
Uli Schlachter d45d31ebae 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:31:00 +02:00
Uli Schlachter 84676561da 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:27:49 +02:00
Uli Schlachter 9977802d7e 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:34:41 +02:00
Uli Schlachter 227b71921d Fix some size hint mixups
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-22 10:34:40 +02:00
Uli Schlachter f372388de9 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:34:39 +02:00
Uli Schlachter 418f3d0b37 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:28:16 +02:00
Daniel Graña cc31fc32e6 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:28:01 +02:00
Uli Schlachter 6de41161f1 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:51:47 +02:00
Uli Schlachter b90aa39dc9 Fix a brown paper bag bug in d7d70714d7
I cherry-picked this commit from master and there was a conflict. I fixed this
up by hand and apparently failed here.

Instead of first saving the systray window and then destroying the wibox, this
first destroyed the wibox and then tried to save the systray, but it was already
destroyed in the previous step. Just swapping these two calls fixes this.

Thanks to anrxc for making me notice how much I fail.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-18 16:20:24 +02:00
Uli Schlachter 312094ace3 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:35:15 +02:00
Uli Schlachter d7d70714d7 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:13:57 +02:00
Uli Schlachter 94a0349c62 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:54:01 +02:00
Uli Schlachter 5487906487 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:40:08 +02:00
Uli Schlachter 62a0189f05 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:40:04 +02:00
Uli Schlachter 0655f13615 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:39:48 +02:00
Uli Schlachter 64855b41cd 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:22:28 +02:00
Uli Schlachter a6f2c73c67 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:40:27 +02:00
Uli Schlachter 985bafaf84 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:39:26 +02:00