Use common/xscreen infra to get screens info
This commit is contained in:
parent
e8e02d5a5d
commit
cbc5ec8060
|
@ -31,14 +31,12 @@
|
||||||
|
|
||||||
#include <confuse.h>
|
#include <confuse.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/extensions/Xinerama.h>
|
|
||||||
|
|
||||||
#include "common/swindow.h"
|
#include "common/swindow.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/version.h"
|
#include "common/version.h"
|
||||||
#include "common/configopts.h"
|
#include "common/configopts.h"
|
||||||
#include "common/xutil.h"
|
#include "common/xutil.h"
|
||||||
|
#include "common/xscreen.c"
|
||||||
|
|
||||||
#define PROGNAME "awesome-menu"
|
#define PROGNAME "awesome-menu"
|
||||||
|
|
||||||
|
@ -603,11 +601,14 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Display *disp;
|
Display *disp;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
int opt, ret;
|
int opt, ret, x, y, i;
|
||||||
char *configfile = NULL, *cmd;
|
char *configfile = NULL, *cmd;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
const char *shell = getenv("SHELL");
|
const char *shell = getenv("SHELL");
|
||||||
Area geometry = { 0, 0, 0, 0, NULL, NULL };
|
Area geometry = { 0, 0, 0, 0, NULL, NULL };
|
||||||
|
ScreensInfo *si;
|
||||||
|
unsigned int ui;
|
||||||
|
Window dummy;
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
{"help", 0, NULL, 'h'},
|
{"help", 0, NULL, 'h'},
|
||||||
|
@ -652,37 +653,26 @@ main(int argc, char **argv)
|
||||||
if(!geometry.height)
|
if(!geometry.height)
|
||||||
geometry.height = globalconf.font->height * 1.5;
|
geometry.height = globalconf.font->height * 1.5;
|
||||||
|
|
||||||
/* XXX this must be replace with a common/ infra */
|
si = screensinfo_new(disp);
|
||||||
if(XineramaIsActive(disp))
|
if(si->xinerama_is_active)
|
||||||
{
|
{
|
||||||
XineramaScreenInfo *si;
|
|
||||||
int xinerama_screen_number, i, x, y;
|
|
||||||
unsigned int ui;
|
|
||||||
Window dummy;
|
|
||||||
|
|
||||||
XQueryPointer(disp, RootWindow(disp, DefaultScreen(disp)),
|
XQueryPointer(disp, RootWindow(disp, DefaultScreen(disp)),
|
||||||
&dummy, &dummy, &x, &y, &i, &i, &ui);
|
&dummy, &dummy, &x, &y, &i, &i, &ui);
|
||||||
|
|
||||||
si = XineramaQueryScreens(disp, &xinerama_screen_number);
|
i = screen_get_bycoord(si, 0, x, y);
|
||||||
|
|
||||||
/* XXX use screen_get_bycoord() !!! */
|
|
||||||
for(i = 0; i < xinerama_screen_number; i++)
|
|
||||||
if((x < 0 || (x >= si[i].x_org && x < si[i].x_org + si[i].width))
|
|
||||||
&& (y < 0 || (y >= si[i].y_org && y < si[i].y_org + si[i].height)))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if(!geometry.x)
|
if(!geometry.x)
|
||||||
geometry.x = si[i].x_org;
|
geometry.x = si->geometry[i].x;
|
||||||
if(!geometry.y)
|
if(!geometry.y)
|
||||||
geometry.y = si[i].y_org;
|
geometry.y = si->geometry[i].y;
|
||||||
if(!geometry.width)
|
if(!geometry.width)
|
||||||
geometry.width = si[i].width;
|
geometry.width = si->geometry[i].width;
|
||||||
|
|
||||||
XFree(si);
|
|
||||||
}
|
}
|
||||||
else if(!geometry.width)
|
else if(!geometry.width)
|
||||||
geometry.width = DisplayWidth(disp, DefaultScreen(disp));
|
geometry.width = DisplayWidth(disp, DefaultScreen(disp));
|
||||||
|
|
||||||
|
screensinfo_delete(&si);
|
||||||
|
|
||||||
/* Create the window */
|
/* Create the window */
|
||||||
globalconf.sw = simplewindow_new(disp, DefaultScreen(disp),
|
globalconf.sw = simplewindow_new(disp, DefaultScreen(disp),
|
||||||
geometry.x, geometry.y, geometry.width, geometry.height, 0);
|
geometry.x, geometry.y, geometry.width, geometry.height, 0);
|
||||||
|
|
Loading…
Reference in New Issue