Remove globalconf.xinerama_is_active

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-08-16 14:20:45 +02:00
parent cb550e59f7
commit 6b2e4352bb
8 changed files with 11 additions and 55 deletions

View File

@ -59,8 +59,6 @@ typedef struct
xcb_key_symbols_t *keysyms; xcb_key_symbols_t *keysyms;
/** Logical screens */ /** Logical screens */
screen_array_t screens; screen_array_t screens;
/** True if xinerama is active */
bool xinerama_is_active;
/** Root window key bindings */ /** Root window key bindings */
key_array_t keys; key_array_t keys;
/** Root window mouse bindings */ /** Root window mouse bindings */

View File

@ -33,7 +33,6 @@ module("awesome")
--- Spawn a program. --- Spawn a program.
-- @param cmd The command to launch. -- @param cmd The command to launch.
-- @param use_sn Use startup-notification, true or false, default to true. -- @param use_sn Use startup-notification, true or false, default to true.
-- @param screen Optional screen number to spawn the command on.
-- @return Process ID if everything is OK, or an error string if an error occured. -- @return Process ID if everything is OK, or an error string if an error occured.
--- Add a global signal. --- Add a global signal.

View File

@ -30,8 +30,6 @@ module("root")
-- event, this is a boolean value which if true make the coordinates relatives. -- event, this is a boolean value which if true make the coordinates relatives.
-- @param x In case of a motion event, this is the X coordinate. -- @param x In case of a motion event, this is the X coordinate.
-- @param y In case of a motion event, this is the Y coordinate. -- @param y In case of a motion event, this is the Y coordinate.
-- @param screen In case of a motion event, this is the screen number to move on.
-- If not specified, the current one is used.
-- @name fake_input -- @name fake_input
-- @class function -- @class function

View File

@ -1360,12 +1360,10 @@ luaA_client_geometry(lua_State *L)
static int static int
luaA_client_set_screen(lua_State *L, client_t *c) luaA_client_set_screen(lua_State *L, client_t *c)
{ {
if(globalconf.xinerama_is_active)
{
int screen = luaL_checknumber(L, -1) - 1; int screen = luaL_checknumber(L, -1) - 1;
luaA_checkscreen(screen); luaA_checkscreen(screen);
screen_client_moveto(c, &globalconf.screens.tab[screen], true); screen_client_moveto(c, &globalconf.screens.tab[screen], true);
}
return 0; return 0;
} }

View File

@ -332,14 +332,8 @@ static int
property_handle_xrootpmap_id(uint8_t state, property_handle_xrootpmap_id(uint8_t state,
xcb_window_t window) xcb_window_t window)
{ {
if(globalconf.xinerama_is_active)
foreach(w, globalconf.wiboxes) foreach(w, globalconf.wiboxes)
(*w)->need_update = true; (*w)->need_update = true;
else
{
foreach(w, globalconf.wiboxes)
(*w)->need_update = true;
}
return 0; return 0;
} }

10
root.c
View File

@ -41,7 +41,6 @@
* event, this is a boolean value which if true make the coordinates relatives. * event, this is a boolean value which if true make the coordinates relatives.
* \lparam In case of a motion event, this is the X coordinate. * \lparam In case of a motion event, this is the X coordinate.
* \lparam In case of a motion event, this is the Y coordinate. * \lparam In case of a motion event, this is the Y coordinate.
* \lparam In case of a motion event, this is the screen number to move on.
* If not specified, the current one is used. * If not specified, the current one is used.
*/ */
static int static int
@ -57,7 +56,6 @@ luaA_root_fake_input(lua_State *L)
const char *stype = luaL_checklstring(L, 1, &tlen); const char *stype = luaL_checklstring(L, 1, &tlen);
uint8_t type, detail; uint8_t type, detail;
int x = 0, y = 0; int x = 0, y = 0;
xcb_window_t root = XCB_NONE;
switch(a_tokenize(stype, tlen)) switch(a_tokenize(stype, tlen))
{ {
@ -82,12 +80,6 @@ luaA_root_fake_input(lua_State *L)
detail = luaA_checkboolean(L, 2); /* relative to the current position or not */ detail = luaA_checkboolean(L, 2); /* relative to the current position or not */
x = luaL_checknumber(L, 3); x = luaL_checknumber(L, 3);
y = luaL_checknumber(L, 4); y = luaL_checknumber(L, 4);
if(lua_gettop(L) == 5 && !globalconf.xinerama_is_active)
{
int screen = luaL_checknumber(L, 5) - 1;
luaA_checkscreen(screen);
root = globalconf.screen->root;
}
break; break;
default: default:
return 0; return 0;
@ -97,7 +89,7 @@ luaA_root_fake_input(lua_State *L)
type, type,
detail, detail,
XCB_CURRENT_TIME, XCB_CURRENT_TIME,
root, XCB_NONE,
x, y, x, y,
0); 0);
return 0; return 0;

View File

@ -145,10 +145,6 @@ screen_scan_randr(void)
p_delete(&screen_res_r); p_delete(&screen_res_r);
/* If RandR provides more than 2 active CRTC, Xinerama is enabled */
if(globalconf.screens.len > 1)
globalconf.xinerama_is_active = true;
return true; return true;
} }
} }
@ -159,16 +155,18 @@ screen_scan_randr(void)
static bool static bool
screen_scan_xinerama(void) screen_scan_xinerama(void)
{ {
bool xinerama_is_active = false;
/* Check for extension before checking for Xinerama */ /* Check for extension before checking for Xinerama */
if(xcb_get_extension_data(globalconf.connection, &xcb_xinerama_id)->present) if(xcb_get_extension_data(globalconf.connection, &xcb_xinerama_id)->present)
{ {
xcb_xinerama_is_active_reply_t *xia; xcb_xinerama_is_active_reply_t *xia;
xia = xcb_xinerama_is_active_reply(globalconf.connection, xcb_xinerama_is_active(globalconf.connection), NULL); xia = xcb_xinerama_is_active_reply(globalconf.connection, xcb_xinerama_is_active(globalconf.connection), NULL);
globalconf.xinerama_is_active = xia->state; xinerama_is_active = xia->state;
p_delete(&xia); p_delete(&xia);
} }
if(globalconf.xinerama_is_active) if(xinerama_is_active)
{ {
xcb_xinerama_query_screens_reply_t *xsq; xcb_xinerama_query_screens_reply_t *xsq;
xcb_xinerama_screen_info_t *xsi; xcb_xinerama_screen_info_t *xsi;
@ -249,10 +247,6 @@ screen_scan(void)
screen_t * screen_t *
screen_getbycoord(screen_t *screen, int x, int y) screen_getbycoord(screen_t *screen, int x, int y)
{ {
/* don't waste our time */
if(!globalconf.xinerama_is_active)
return screen;
foreach(s, globalconf.screens) foreach(s, globalconf.screens)
if((x < 0 || (x >= s->geometry.x && x < s->geometry.x + s->geometry.width)) if((x < 0 || (x >= s->geometry.x && x < s->geometry.x + s->geometry.width))
&& (y < 0 || (y >= s->geometry.y && y < s->geometry.y + s->geometry.height))) && (y < 0 || (y >= s->geometry.y && y < s->geometry.y + s->geometry.height)))

17
spawn.c
View File

@ -283,36 +283,19 @@ spawn_command(const gchar *command_line, GError **error)
* \luastack * \luastack
* \lparam The command to launch. * \lparam The command to launch.
* \lparam Use startup-notification, true or false, default to true. * \lparam Use startup-notification, true or false, default to true.
* \lparam The optional screen number to spawn the command on.
* \lreturn Process ID if everything is OK, or an error string if an error occured. * \lreturn Process ID if everything is OK, or an error string if an error occured.
*/ */
int int
luaA_spawn(lua_State *L) luaA_spawn(lua_State *L)
{ {
char *host, newdisplay[128];
const char *cmd; const char *cmd;
bool use_sn = true; bool use_sn = true;
int screen = 0, screenp, displayp;
if(lua_gettop(L) >= 2) if(lua_gettop(L) >= 2)
use_sn = luaA_checkboolean(L, 2); use_sn = luaA_checkboolean(L, 2);
if(lua_gettop(L) == 3)
{
screen = luaL_checknumber(L, 3) - 1;
luaA_checkscreen(screen);
}
cmd = luaL_checkstring(L, 1); cmd = luaL_checkstring(L, 1);
if(!globalconf.xinerama_is_active)
{
xcb_parse_display(NULL, &host, &displayp, &screenp);
snprintf(newdisplay, sizeof(newdisplay), "%s:%d.%d", host, displayp, screen);
setenv("DISPLAY", newdisplay, 1);
p_delete(&host);
}
SnLauncherContext *context = NULL; SnLauncherContext *context = NULL;
if(use_sn) if(use_sn)
{ {