add screen.[ch] to handle Xinerama config, and deprecate get_wa*()
This commit is contained in:
parent
c31e10554b
commit
c7735d4d1f
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@
|
|||
|
||||
include config.mk
|
||||
|
||||
SRC = client.c draw.c event.c layout.c awesome.c tag.c util.c config.c
|
||||
SRC = client.c draw.c event.c layout.c awesome.c tag.c util.c config.c screen.c
|
||||
OBJ = ${SRC:.c=.o} ${LAYOUTS:.c=.o}
|
||||
|
||||
all: options awesome
|
||||
|
|
|
@ -28,9 +28,9 @@ Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return tex
|
|||
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
||||
void uicb_quit(Display *, DC *, awesome_config *, const char *); /* quit awesome nicely */
|
||||
int xerror(Display *, XErrorEvent *); /* awesome's X error handler */
|
||||
int get_windows_area_x(Statusbar);
|
||||
int get_windows_area_y(Statusbar);
|
||||
int get_windows_area_height(Display *, Statusbar);
|
||||
int get_windows_area_width(Display *, Statusbar);
|
||||
int __attribute__ ((deprecated)) get_windows_area_x(Statusbar);
|
||||
int __attribute__ ((deprecated)) get_windows_area_y(Statusbar);
|
||||
int __attribute__ ((deprecated)) get_windows_area_height(Display *, Statusbar);
|
||||
int __attribute__ ((deprecated)) get_windows_area_width(Display *, Statusbar);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "awesome.h"
|
||||
#include "tag.h"
|
||||
#include "layout.h"
|
||||
|
@ -104,31 +104,11 @@ _tile(Display *disp, awesome_config *awesomeconf, const Bool right)
|
|||
unsigned int mw = 0, mh = 0;
|
||||
int n, i, li, last_i = 0, nmaster_screen = 0, otherwin_screen = 0;
|
||||
int screen_numbers = 1, use_screen = -1;
|
||||
XineramaScreenInfo *screens_info = NULL;
|
||||
ScreenInfo *screens_info = NULL;
|
||||
Client *c;
|
||||
|
||||
if(XineramaIsActive(disp))
|
||||
{
|
||||
screens_info = XineramaQueryScreens(disp, &screen_numbers);
|
||||
for(i = 0; i < screen_numbers; i++)
|
||||
{
|
||||
if(awesomeconf->statusbar.position == BarTop
|
||||
|| awesomeconf->statusbar.position == BarBot)
|
||||
screens_info[i].height -= awesomeconf->statusbar.height;
|
||||
if(awesomeconf->statusbar.position == BarTop)
|
||||
screens_info[i].y_org += awesomeconf->statusbar.height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* emulate Xinerama info */
|
||||
screens_info = p_new(XineramaScreenInfo, 1);
|
||||
screens_info->width = get_windows_area_width(disp, awesomeconf->statusbar);
|
||||
screens_info->height = get_windows_area_height(disp, awesomeconf->statusbar);
|
||||
screens_info->x_org = get_windows_area_x(awesomeconf->statusbar);
|
||||
screens_info->y_org = get_windows_area_y(awesomeconf->statusbar);
|
||||
}
|
||||
|
||||
screens_info = get_screen_info(disp, awesomeconf->statusbar, &screen_numbers);
|
||||
|
||||
for(n = 0, c = clients; c; c = c->next)
|
||||
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
|
||||
n++;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* screen.c - screen management
|
||||
*
|
||||
* Copyright © 2007 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "util.h"
|
||||
#include "screen.h"
|
||||
|
||||
ScreenInfo *
|
||||
get_screen_info(Display *disp, Statusbar statusbar, int *screen_number)
|
||||
{
|
||||
int i;
|
||||
ScreenInfo *si;
|
||||
|
||||
if(XineramaIsActive(disp))
|
||||
si = XineramaQueryScreens(disp, screen_number);
|
||||
else
|
||||
{
|
||||
/* emulate Xinerama info */
|
||||
*screen_number = 1;
|
||||
si = p_new(XineramaScreenInfo, 1);
|
||||
si->width = DisplayWidth(disp, DefaultScreen(disp));
|
||||
si->height = DisplayHeight(disp, DefaultScreen(disp));
|
||||
si->x_org = 0;
|
||||
si->y_org = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < *screen_number; i++)
|
||||
{
|
||||
if(statusbar.position == BarTop
|
||||
|| statusbar.position == BarBot)
|
||||
si[i].height -= statusbar.height;
|
||||
if(statusbar.position == BarTop)
|
||||
si[i].y_org += statusbar.height;
|
||||
}
|
||||
|
||||
return si;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* screen.h - screen management header
|
||||
*
|
||||
* Copyright © 2007 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AWESOME_SCREEN_H
|
||||
#define AWESOME_SCREEN_H
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
|
||||
typedef XineramaScreenInfo ScreenInfo;
|
||||
|
||||
ScreenInfo * get_screen_info(Display *, Statusbar, int *);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue