client: move floating state handling to Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
26de388c4c
commit
c3c20c4f8e
|
@ -229,7 +229,7 @@ keybinding({ modkey, "Shift" }, "j", function () awful.client.swap.byidx(1) end)
|
||||||
keybinding({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end):add()
|
keybinding({ modkey, "Shift" }, "k", function () awful.client.swap.byidx(-1) end):add()
|
||||||
keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
|
keybinding({ modkey, "Control" }, "j", function () awful.screen.focus(1) end):add()
|
||||||
keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
|
keybinding({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end):add()
|
||||||
keybinding({ modkey, "Control" }, "space", awful.client.togglefloating):add()
|
keybinding({ modkey, "Control" }, "space", awful.client.floating.toggle):add()
|
||||||
keybinding({ modkey, "Control" }, "Return", function () if client.focus then client.focus:swap(awful.client.getmaster()) end end):add()
|
keybinding({ modkey, "Control" }, "Return", function () if client.focus then client.focus:swap(awful.client.getmaster()) end end):add()
|
||||||
keybinding({ modkey }, "o", awful.client.movetoscreen):add()
|
keybinding({ modkey }, "o", awful.client.movetoscreen):add()
|
||||||
keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()
|
keybinding({ modkey }, "Tab", awful.client.focus.history.previous):add()
|
||||||
|
@ -345,9 +345,9 @@ awful.hooks.manage.register(function (c)
|
||||||
local cls = c.class
|
local cls = c.class
|
||||||
local inst = c.instance
|
local inst = c.instance
|
||||||
if floatapps[cls] then
|
if floatapps[cls] then
|
||||||
c.floating = floatapps[cls]
|
awful.client.floating.set(cls, floatapps[cls])
|
||||||
elseif floatapps[inst] then
|
elseif floatapps[inst] then
|
||||||
c.floating = floatapps[inst]
|
awful.client.floating.set(cls, floatapps[inst])
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check application->screen/tag mappings.
|
-- Check application->screen/tag mappings.
|
||||||
|
|
70
client.c
70
client.c
|
@ -51,7 +51,7 @@ client_loadprops(client_t * c, screen_t *screen)
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
tag_array_t *tags = &screen->tags;
|
tag_array_t *tags = &screen->tags;
|
||||||
char *prop = NULL;
|
char *prop = NULL;
|
||||||
xcb_get_property_cookie_t floating_q, fullscreen_q;
|
xcb_get_property_cookie_t fullscreen_q;
|
||||||
xcb_get_property_reply_t *reply;
|
xcb_get_property_reply_t *reply;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
@ -60,9 +60,6 @@ client_loadprops(client_t * c, screen_t *screen)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Send the GetProperty requests which will be processed later */
|
/* Send the GetProperty requests which will be processed later */
|
||||||
floating_q = xcb_get_property_unchecked(globalconf.connection, false, c->win,
|
|
||||||
_AWESOME_FLOATING, CARDINAL, 0, 1);
|
|
||||||
|
|
||||||
fullscreen_q = xcb_get_property_unchecked(globalconf.connection, false, c->win,
|
fullscreen_q = xcb_get_property_unchecked(globalconf.connection, false, c->win,
|
||||||
_AWESOME_FULLSCREEN, CARDINAL, 0, 1);
|
_AWESOME_FULLSCREEN, CARDINAL, 0, 1);
|
||||||
|
|
||||||
|
@ -76,13 +73,6 @@ client_loadprops(client_t * c, screen_t *screen)
|
||||||
|
|
||||||
p_delete(&prop);
|
p_delete(&prop);
|
||||||
|
|
||||||
/* check for floating */
|
|
||||||
reply = xcb_get_property_reply(globalconf.connection, floating_q, NULL);
|
|
||||||
|
|
||||||
if(reply && reply->value_len && (data = xcb_get_property_value(reply)))
|
|
||||||
client_setfloating(c, *(bool *) data);
|
|
||||||
p_delete(&reply);
|
|
||||||
|
|
||||||
/* check for fullscreen */
|
/* check for fullscreen */
|
||||||
reply = xcb_get_property_reply(globalconf.connection, fullscreen_q, NULL);
|
reply = xcb_get_property_reply(globalconf.connection, fullscreen_q, NULL);
|
||||||
|
|
||||||
|
@ -308,8 +298,7 @@ typedef enum
|
||||||
LAYER_IGNORE,
|
LAYER_IGNORE,
|
||||||
LAYER_DESKTOP,
|
LAYER_DESKTOP,
|
||||||
LAYER_BELOW,
|
LAYER_BELOW,
|
||||||
LAYER_TILE,
|
LAYER_NORMAL,
|
||||||
LAYER_FLOAT,
|
|
||||||
LAYER_ABOVE,
|
LAYER_ABOVE,
|
||||||
LAYER_FULLSCREEN,
|
LAYER_FULLSCREEN,
|
||||||
LAYER_ONTOP,
|
LAYER_ONTOP,
|
||||||
|
@ -332,8 +321,6 @@ client_layer_translator(client_t *c)
|
||||||
return LAYER_ABOVE;
|
return LAYER_ABOVE;
|
||||||
else if(c->isbelow)
|
else if(c->isbelow)
|
||||||
return LAYER_BELOW;
|
return LAYER_BELOW;
|
||||||
else if(c->isfloating || c->ismaxhoriz || c->ismaxvert)
|
|
||||||
return LAYER_FLOAT;
|
|
||||||
|
|
||||||
/* check for transient attr */
|
/* check for transient attr */
|
||||||
if(c->transient_for)
|
if(c->transient_for)
|
||||||
|
@ -350,15 +337,12 @@ client_layer_translator(client_t *c)
|
||||||
case WINDOW_TYPE_MENU:
|
case WINDOW_TYPE_MENU:
|
||||||
case WINDOW_TYPE_TOOLBAR:
|
case WINDOW_TYPE_TOOLBAR:
|
||||||
case WINDOW_TYPE_UTILITY:
|
case WINDOW_TYPE_UTILITY:
|
||||||
return LAYER_FLOAT;
|
return LAYER_ABOVE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client_isfixed(c))
|
return LAYER_NORMAL;
|
||||||
return LAYER_FLOAT;
|
|
||||||
|
|
||||||
return LAYER_TILE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Restack clients.
|
/** Restack clients.
|
||||||
|
@ -466,10 +450,10 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
|
|
||||||
/* Initial values */
|
/* Initial values */
|
||||||
c->win = w;
|
c->win = w;
|
||||||
c->geometry.x = c->geometries.floating.x = wgeom->x;
|
c->geometry.x = wgeom->x;
|
||||||
c->geometry.y = c->geometries.floating.y = wgeom->y;
|
c->geometry.y = wgeom->y;
|
||||||
c->geometry.width = c->geometries.floating.width = wgeom->width;
|
c->geometry.width = wgeom->width;
|
||||||
c->geometry.height = c->geometries.floating.height = wgeom->height;
|
c->geometry.height = wgeom->height;
|
||||||
client_setborder(c, wgeom->border_width);
|
client_setborder(c, wgeom->border_width);
|
||||||
if((icon = ewmh_window_icon_get_reply(ewmh_icon_cookie)))
|
if((icon = ewmh_window_icon_get_reply(ewmh_icon_cookie)))
|
||||||
c->icon = image_ref(&icon);
|
c->icon = image_ref(&icon);
|
||||||
|
@ -662,12 +646,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
c->geometry.width = values[2] = geometry.width;
|
c->geometry.width = values[2] = geometry.width;
|
||||||
c->geometry.height = values[3] = geometry.height;
|
c->geometry.height = values[3] = geometry.height;
|
||||||
|
|
||||||
/* save the floating geometry if the window is floating but not
|
|
||||||
* maximized */
|
|
||||||
if(client_isfloating(c)
|
|
||||||
&& !(c->isfullscreen || c->ismaxvert || c->ismaxhoriz))
|
|
||||||
c->geometries.floating = geometry;
|
|
||||||
|
|
||||||
titlebar_update_geometry(c);
|
titlebar_update_geometry(c);
|
||||||
|
|
||||||
/* The idea is to give a client a resize even when banned. */
|
/* The idea is to give a client a resize even when banned. */
|
||||||
|
@ -693,31 +671,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set a client floating.
|
|
||||||
* \param c The client.
|
|
||||||
* \param floating Set floating, or not.
|
|
||||||
* \param layer Layer to put the floating window onto.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
client_setfloating(client_t *c, bool floating)
|
|
||||||
{
|
|
||||||
if(c->isfloating != floating
|
|
||||||
&& (c->type == WINDOW_TYPE_NORMAL))
|
|
||||||
{
|
|
||||||
if((c->isfloating = floating))
|
|
||||||
if(!c->isfullscreen)
|
|
||||||
client_resize(c, c->geometries.floating, false);
|
|
||||||
client_need_arrange(c);
|
|
||||||
client_stack();
|
|
||||||
xcb_change_property(globalconf.connection,
|
|
||||||
XCB_PROP_MODE_REPLACE,
|
|
||||||
c->win, _AWESOME_FLOATING, CARDINAL, 8, 1,
|
|
||||||
&c->isfloating);
|
|
||||||
/* execute hook */
|
|
||||||
hooks_property(c, "floating");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set a client minimized, or not.
|
/** Set a client minimized, or not.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \param s Set or not the client minimized.
|
* \param s Set or not the client minimized.
|
||||||
|
@ -1458,9 +1411,6 @@ luaA_client_newindex(lua_State *L)
|
||||||
window_opacity_set((*c)->win, d);
|
window_opacity_set((*c)->win, d);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case A_TK_FLOATING:
|
|
||||||
client_setfloating(*c, luaA_checkboolean(L, 3));
|
|
||||||
break;
|
|
||||||
case A_TK_STICKY:
|
case A_TK_STICKY:
|
||||||
client_setsticky(*c, luaA_checkboolean(L, 3));
|
client_setsticky(*c, luaA_checkboolean(L, 3));
|
||||||
break;
|
break;
|
||||||
|
@ -1515,7 +1465,6 @@ luaA_client_newindex(lua_State *L)
|
||||||
* \lfield minimize Define it the client must be iconify, i.e. only visible in
|
* \lfield minimize Define it the client must be iconify, i.e. only visible in
|
||||||
* taskbar.
|
* taskbar.
|
||||||
* \lfield icon_path Path to the icon used to identify.
|
* \lfield icon_path Path to the icon used to identify.
|
||||||
* \lfield floating True always floating.
|
|
||||||
* \lfield honorsizehints Honor size hints, i.e. respect size ratio.
|
* \lfield honorsizehints Honor size hints, i.e. respect size ratio.
|
||||||
* \lfield border_width The client border width.
|
* \lfield border_width The client border width.
|
||||||
* \lfield border_color The client border color.
|
* \lfield border_color The client border color.
|
||||||
|
@ -1669,9 +1618,6 @@ luaA_client_index(lua_State *L)
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case A_TK_FLOATING:
|
|
||||||
lua_pushboolean(L, client_isfloating(*c));
|
|
||||||
break;
|
|
||||||
case A_TK_ONTOP:
|
case A_TK_ONTOP:
|
||||||
lua_pushboolean(L, (*c)->isontop);
|
lua_pushboolean(L, (*c)->isontop);
|
||||||
break;
|
break;
|
||||||
|
|
16
client.h
16
client.h
|
@ -55,7 +55,6 @@ void client_resize(client_t *, area_t, bool);
|
||||||
void client_unmanage(client_t *);
|
void client_unmanage(client_t *);
|
||||||
void client_saveprops_tags(client_t *);
|
void client_saveprops_tags(client_t *);
|
||||||
void client_kill(client_t *);
|
void client_kill(client_t *);
|
||||||
void client_setfloating(client_t *, bool);
|
|
||||||
void client_setsticky(client_t *, bool);
|
void client_setsticky(client_t *, bool);
|
||||||
void client_setabove(client_t *, bool);
|
void client_setabove(client_t *, bool);
|
||||||
void client_setbelow(client_t *, bool);
|
void client_setbelow(client_t *, bool);
|
||||||
|
@ -109,21 +108,6 @@ client_isfixed(client_t *c)
|
||||||
&& c->maxw == c->minw && c->maxh == c->minh);
|
&& c->maxw == c->minw && c->maxh == c->minh);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if a client is floating.
|
|
||||||
* \param c A client.
|
|
||||||
* \return A boolean value, true if the client is floating.
|
|
||||||
*/
|
|
||||||
static inline bool
|
|
||||||
client_isfloating(client_t *c)
|
|
||||||
{
|
|
||||||
return (c->type != WINDOW_TYPE_NORMAL
|
|
||||||
|| c->isfloating
|
|
||||||
|| c->isfullscreen
|
|
||||||
|| c->ismaxhoriz
|
|
||||||
|| c->ismaxvert
|
|
||||||
|| client_isfixed(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true if a client is tagged
|
/** Returns true if a client is tagged
|
||||||
* with one of the tags of the specified screen and is not hidden.
|
* with one of the tags of the specified screen and is not hidden.
|
||||||
* \param c The client to check.
|
* \param c The client to check.
|
||||||
|
|
10
event.c
10
event.c
|
@ -265,8 +265,6 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
|
||||||
|
|
||||||
if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
|
if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
|
||||||
|| geometry.width != c->geometry.width || geometry.height != c->geometry.height)
|
|| geometry.width != c->geometry.width || geometry.height != c->geometry.height)
|
||||||
{
|
|
||||||
if(client_isfloating(c))
|
|
||||||
{
|
{
|
||||||
client_resize(c, geometry, false);
|
client_resize(c, geometry, false);
|
||||||
if(client_hasstrut(c))
|
if(client_hasstrut(c))
|
||||||
|
@ -277,15 +275,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
|
||||||
wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
|
wibox_t *s = globalconf.screens[screen].wiboxes.tab[i];
|
||||||
wibox_position_update(s);
|
wibox_position_update(s);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
client_need_arrange(c);
|
client_need_arrange(c);
|
||||||
/* If we do not resize the client, at least tell it that it
|
|
||||||
* has its new configuration. That fixes at least
|
|
||||||
* gnome-terminal */
|
|
||||||
window_configure(c->win, c->geometry, c->border);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
window_configure(c->win, geometry, c->border);
|
window_configure(c->win, geometry, c->border);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local hooks = require("awful.hooks")
|
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local tag = require("awful.tag")
|
local tag = require("awful.tag")
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
|
@ -19,7 +18,9 @@ local capi =
|
||||||
client = client,
|
client = client,
|
||||||
mouse = mouse,
|
mouse = mouse,
|
||||||
screen = screen,
|
screen = screen,
|
||||||
|
hooks = hooks
|
||||||
}
|
}
|
||||||
|
local hooks = require("awful.hooks")
|
||||||
|
|
||||||
--- Client module for awful
|
--- Client module for awful
|
||||||
module("awful.client")
|
module("awful.client")
|
||||||
|
@ -29,12 +30,14 @@ local data = {}
|
||||||
data.focus = {}
|
data.focus = {}
|
||||||
data.urgent = {}
|
data.urgent = {}
|
||||||
data.marked = {}
|
data.marked = {}
|
||||||
|
data.floating = otable()
|
||||||
|
|
||||||
-- Urgent functions
|
-- Urgent functions
|
||||||
urgent = {}
|
urgent = {}
|
||||||
focus = {}
|
focus = {}
|
||||||
focus.history = {}
|
focus.history = {}
|
||||||
swap = {}
|
swap = {}
|
||||||
|
floating = {}
|
||||||
|
|
||||||
-- User hooks
|
-- User hooks
|
||||||
hooks.user.create('marked')
|
hooks.user.create('marked')
|
||||||
|
@ -193,7 +196,7 @@ function tiled(screen)
|
||||||
local tclients = {}
|
local tclients = {}
|
||||||
-- Remove floating clients
|
-- Remove floating clients
|
||||||
for k, c in pairs(clients) do
|
for k, c in pairs(clients) do
|
||||||
if not c.floating then
|
if not floating.get(c) then
|
||||||
table.insert(tclients, c)
|
table.insert(tclients, c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -426,15 +429,6 @@ function toggletag(target, c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Toggle the floating status of a client.
|
|
||||||
-- @param c Optional client, the focused one if not set.
|
|
||||||
function togglefloating(c)
|
|
||||||
local sel = c or capi.client.focus
|
|
||||||
if sel then
|
|
||||||
sel.floating = not sel.floating
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Move a client to a screen. Default is next screen, cycling.
|
--- Move a client to a screen. Default is next screen, cycling.
|
||||||
-- @param c The client to move.
|
-- @param c The client to move.
|
||||||
-- @param s The screen number, default to current + 1.
|
-- @param s The screen number, default to current + 1.
|
||||||
|
@ -525,6 +519,49 @@ function getmarked()
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set a client floating state.
|
||||||
|
-- Floating client are not handled by tiling layouts.
|
||||||
|
-- @param c A client.
|
||||||
|
-- @param state True or false.
|
||||||
|
function floating.set(c, s)
|
||||||
|
local c = c or capi.client.focus
|
||||||
|
if c and data.floating[c] ~= s then
|
||||||
|
data.floating[c] = s
|
||||||
|
capi.hooks.arrange()(c.screen)
|
||||||
|
capi.hooks.property()(c, "floating")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get a client floating state.
|
||||||
|
-- @param c A client.
|
||||||
|
-- @return True or false. Note that some windows might be floating even if you
|
||||||
|
-- did not set them manually. For example, windows with a type different than
|
||||||
|
-- normal.
|
||||||
|
function floating.get(c)
|
||||||
|
local c = c or capi.client.focus
|
||||||
|
if c then
|
||||||
|
if data.floating[c] ~= nil then
|
||||||
|
return data.floating[c]
|
||||||
|
end
|
||||||
|
return (c.type ~= "normal"
|
||||||
|
or c.fullscreen
|
||||||
|
or c.maximized_vertical
|
||||||
|
or c.maximized_horizontal)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Toggle the floating state of a client.
|
||||||
|
-- @param c A client.
|
||||||
|
function floating.toggle(c)
|
||||||
|
floating.set(c, not floating.get(c))
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Remove the floating information on a client.
|
||||||
|
-- @param c The client.
|
||||||
|
function floating.delete(c)
|
||||||
|
data.floating[c] = nil
|
||||||
|
end
|
||||||
|
|
||||||
-- Register standards hooks
|
-- Register standards hooks
|
||||||
hooks.focus.register(focus.history.add)
|
hooks.focus.register(focus.history.add)
|
||||||
hooks.unmanage.register(focus.history.delete)
|
hooks.unmanage.register(focus.history.delete)
|
||||||
|
@ -533,4 +570,6 @@ hooks.property.register(urgent.add)
|
||||||
hooks.focus.register(urgent.delete)
|
hooks.focus.register(urgent.delete)
|
||||||
hooks.unmanage.register(urgent.delete)
|
hooks.unmanage.register(urgent.delete)
|
||||||
|
|
||||||
|
hooks.unmanage.register(floating.delete)
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -26,7 +26,7 @@ local function fmax(screen, fs)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, c in pairs(client.visible(screen)) do
|
for k, c in pairs(client.visible(screen)) do
|
||||||
if not c.floating then
|
if not client.floating.get(c) then
|
||||||
area.width = area.width - 2 * c.border_width
|
area.width = area.width - 2 * c.border_width
|
||||||
area.height = area.height - 2 * c.border_width
|
area.height = area.height - 2 * c.border_width
|
||||||
c:fullgeometry(area)
|
c:fullgeometry(area)
|
||||||
|
|
|
@ -109,18 +109,18 @@ function client.move(c, snap)
|
||||||
for k, v in ipairs(mouse.buttons) do
|
for k, v in ipairs(mouse.buttons) do
|
||||||
if v then
|
if v then
|
||||||
local lay = layout.get(c.screen)
|
local lay = layout.get(c.screen)
|
||||||
if lay == layout.suit.floating or c.floating then
|
if lay == layout.suit.floating or aclient.floating.get(c) then
|
||||||
local x = mouse.x - dist_x
|
local x = mouse.x - dist_x
|
||||||
local y = mouse.y - dist_y
|
local y = mouse.y - dist_y
|
||||||
c:fullgeometry(client.snap(c, snap, x, y))
|
c:fullgeometry(client.snap(c, snap, x, y))
|
||||||
if layout.get(c.screen) ~= layout.suit.floating and not c.floating then
|
if layout.get(c.screen) ~= layout.suit.floating and not aclient.floating.get(c) then
|
||||||
hooks.property.register(ug)
|
hooks.property.register(ug)
|
||||||
end
|
end
|
||||||
elseif lay ~= layout.suit.magnifier then
|
elseif lay ~= layout.suit.magnifier then
|
||||||
c.screen = capi.mouse.screen
|
c.screen = capi.mouse.screen
|
||||||
if layout.get(c.screen) ~= layout.suit.floating then
|
if layout.get(c.screen) ~= layout.suit.floating then
|
||||||
local c_u_m = capi.mouse.client_under_pointer()
|
local c_u_m = capi.mouse.client_under_pointer()
|
||||||
if c_u_m and not c_u_m.floating then
|
if c_u_m and not aclient.floating.get(c_u_m) then
|
||||||
if c_u_m ~= c then
|
if c_u_m ~= c then
|
||||||
c:swap(c_u_m)
|
c:swap(c_u_m)
|
||||||
end
|
end
|
||||||
|
@ -265,7 +265,7 @@ local function client_resize_floating(c, corner)
|
||||||
for k, v in ipairs(mouse.buttons) do
|
for k, v in ipairs(mouse.buttons) do
|
||||||
if v then
|
if v then
|
||||||
-- Ignore screen changes
|
-- Ignore screen changes
|
||||||
if not c.floating
|
if not aclient.floating.get(c)
|
||||||
and capi.mouse.screen ~= c.screen then
|
and capi.mouse.screen ~= c.screen then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -332,7 +332,7 @@ function client.resize(c, corner)
|
||||||
|
|
||||||
local lay = layout.get(c.screen)
|
local lay = layout.get(c.screen)
|
||||||
|
|
||||||
if lay == layout.suit.floating or c.floating then
|
if lay == layout.suit.floating or aclient.floating.get(c) then
|
||||||
return client_resize_floating(c, corner)
|
return client_resize_floating(c, corner)
|
||||||
elseif lay == layout.suit.tile
|
elseif lay == layout.suit.tile
|
||||||
or lay == layout.suit.tile.left
|
or lay == layout.suit.tile.left
|
||||||
|
|
|
@ -128,7 +128,7 @@ function no_overlap(c)
|
||||||
local geometry = c:geometry()
|
local geometry = c:geometry()
|
||||||
local fullgeometry = c:fullgeometry()
|
local fullgeometry = c:fullgeometry()
|
||||||
for i, cl in pairs(cls) do
|
for i, cl in pairs(cls) do
|
||||||
if cl ~= c and (cl.floating or layout == layout.suit.floating) then
|
if cl ~= c and (client.get.floating(cl) or layout == layout.suit.floating) then
|
||||||
areas = area_remove(areas, cl:fullgeometry())
|
areas = area_remove(areas, cl:fullgeometry())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,7 @@ local util = require("awful.util")
|
||||||
local hooks = require("awful.hooks")
|
local hooks = require("awful.hooks")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
local menu = require("awful.menu")
|
local menu = require("awful.menu")
|
||||||
|
local client = require("awful.client")
|
||||||
|
|
||||||
--- Widget module for awful
|
--- Widget module for awful
|
||||||
module("awful.widget")
|
module("awful.widget")
|
||||||
|
@ -277,7 +278,7 @@ local function widget_tasklist_label_common(c, args)
|
||||||
local bg = nil
|
local bg = nil
|
||||||
local text = "<margin left=\"2\" right=\"2\"/><span font_desc='"..font.."'>"
|
local text = "<margin left=\"2\" right=\"2\"/><span font_desc='"..font.."'>"
|
||||||
local name
|
local name
|
||||||
if c.floating and floating_icon then
|
if client.floating.get(c) and floating_icon then
|
||||||
text = text.."<bg image=\"" .. floating_icon .. "\" align=\"" .. floating_icon_align .. "\"/>"
|
text = text.."<bg image=\"" .. floating_icon .. "\" align=\"" .. floating_icon_align .. "\"/>"
|
||||||
end
|
end
|
||||||
if c.minimized then
|
if c.minimized then
|
||||||
|
|
|
@ -63,7 +63,7 @@ property_handle_wm_transient_for(void *data,
|
||||||
{
|
{
|
||||||
client_t *c = client_getbywin(window);
|
client_t *c = client_getbywin(window);
|
||||||
|
|
||||||
if(c && !client_isfloating(c))
|
if(c)
|
||||||
property_update_wm_transient_for(c, reply);
|
property_update_wm_transient_for(c, reply);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
15
screen.c
15
screen.c
|
@ -326,11 +326,11 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize)
|
||||||
tag_client(c, new_tags->tab[i]);
|
tag_client(c, new_tags->tab[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* resize the windows if it's floating */
|
/* move and resize the windows */
|
||||||
if(doresize && old_screen != c->screen)
|
if(doresize && old_screen != c->screen)
|
||||||
{
|
{
|
||||||
area_t new_geometry, new_f_geometry;
|
area_t new_geometry, new_f_geometry;
|
||||||
new_f_geometry = c->geometries.floating;
|
new_f_geometry = c->geometry;
|
||||||
|
|
||||||
to = screen_area_get(c->screen,
|
to = screen_area_get(c->screen,
|
||||||
NULL, NULL, false);
|
NULL, NULL, false);
|
||||||
|
@ -338,8 +338,8 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize)
|
||||||
NULL, NULL, false);
|
NULL, NULL, false);
|
||||||
|
|
||||||
/* compute new coords in new screen */
|
/* compute new coords in new screen */
|
||||||
new_f_geometry.x = (c->geometries.floating.x - from.x) + to.x;
|
new_f_geometry.x = (c->geometry.x - from.x) + to.x;
|
||||||
new_f_geometry.y = (c->geometries.floating.y - from.y) + to.y;
|
new_f_geometry.y = (c->geometry.y - from.y) + to.y;
|
||||||
|
|
||||||
/* check that new coords are still in the screen */
|
/* check that new coords are still in the screen */
|
||||||
if(new_f_geometry.width > to.width)
|
if(new_f_geometry.width > to.width)
|
||||||
|
@ -385,13 +385,10 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize)
|
||||||
|
|
||||||
client_resize(c, new_geometry, false);
|
client_resize(c, new_geometry, false);
|
||||||
}
|
}
|
||||||
/* if floating, move to this new coords */
|
/* move to this new coords */
|
||||||
else if(client_isfloating(c))
|
|
||||||
client_resize(c, new_f_geometry, false);
|
|
||||||
/* otherwise just register them */
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c->geometries.floating = new_f_geometry;
|
client_resize(c, new_f_geometry, false);
|
||||||
if(wasvisible)
|
if(wasvisible)
|
||||||
globalconf.screens[old_screen].need_arrange = true;
|
globalconf.screens[old_screen].need_arrange = true;
|
||||||
client_need_arrange(c);
|
client_need_arrange(c);
|
||||||
|
|
|
@ -155,8 +155,6 @@ struct client_t
|
||||||
area_t geometry;
|
area_t geometry;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/** Client floating geometry. */
|
|
||||||
area_t floating;
|
|
||||||
/** Client geometry when (un)fullscreen */
|
/** Client geometry when (un)fullscreen */
|
||||||
area_t fullscreen;
|
area_t fullscreen;
|
||||||
/** Client geometry when (un)-max */
|
/** Client geometry when (un)-max */
|
||||||
|
@ -175,8 +173,6 @@ struct client_t
|
||||||
bool issticky;
|
bool issticky;
|
||||||
/** Has urgency hint */
|
/** Has urgency hint */
|
||||||
bool isurgent;
|
bool isurgent;
|
||||||
/** true if the window is floating */
|
|
||||||
bool isfloating;
|
|
||||||
/** True if the client is hidden */
|
/** True if the client is hidden */
|
||||||
bool ishidden;
|
bool ishidden;
|
||||||
/** True if the client is minimized */
|
/** True if the client is minimized */
|
||||||
|
|
Loading…
Reference in New Issue