From 1cd4ba008676142fee54819a1ede21e20b399472 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 18 Sep 2007 23:16:27 +0200 Subject: [PATCH] stop using get_window_area* fct, and remove it --- TODO | 2 -- awesome.c | 31 ------------------------------- awesome.h | 4 ---- event.c | 18 +++++++++--------- layout.c | 39 ++++++++++++++++++++------------------- 5 files changed, 29 insertions(+), 65 deletions(-) diff --git a/TODO b/TODO index f5d7b761..cf70bd8c 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ For v1.0: - Add uicb for sel->border++-- and awesomeconf->border++-- -- Remove warnings -- Check togglemax - Write manpage For future: diff --git a/awesome.c b/awesome.c index 508cbeeb..c980b980 100644 --- a/awesome.c +++ b/awesome.c @@ -239,37 +239,6 @@ uicb_quit(Display *disp __attribute__ ((unused)), readin = running = False; } -int -get_windows_area_x(Statusbar statusbar __attribute__ ((unused))) -{ - return 0; -} - -int -get_windows_area_y(Statusbar statusbar) -{ - if(statusbar.position == BarTop) - return statusbar.height; - - return 0; -} - -int -get_windows_area_height(Display *disp, Statusbar statusbar) -{ - if(statusbar.position == BarTop || statusbar.position == BarBot) - return DisplayHeight(disp, DefaultScreen(disp)) - statusbar.height; - - return DisplayHeight(disp, DefaultScreen(disp)); -} - -int -get_windows_area_width(Display *disp, - Statusbar statusbar __attribute__ ((unused))) -{ - return DisplayWidth(disp, DefaultScreen(disp)); -} - /* There's no way to check accesses to destroyed windows, thus those cases are * ignored (especially on UnmapNotify's). Other types of errors call Xlibs * default error handler, which may call exit. diff --git a/awesome.h b/awesome.h index d7977d79..79f83f50 100644 --- a/awesome.h +++ b/awesome.h @@ -26,9 +26,5 @@ void uicb_quit(Display *, DC *, awesome_config *, const char *); /* quit awesome nicely */ int xerror(Display *, XErrorEvent *); /* awesome's X error handler */ -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 diff --git a/event.c b/event.c index d7ba215e..4dc8b7aa 100644 --- a/event.c +++ b/event.c @@ -60,7 +60,7 @@ movemouse(Client * c, int screen, awesome_config *awesomeconf) XEvent ev; ScreenInfo *si; - si = get_display_info(c->display, c->screen, awesomeconf[screen].statusbar); + si = get_screen_info(c->display, c->screen, awesomeconf[screen].statusbar, &x1); ocx = nx = c->x; ocy = ny = c->y; @@ -85,14 +85,14 @@ movemouse(Client * c, int screen, awesome_config *awesomeconf) XSync(c->display, False); nx = ocx + (ev.xmotion.x - x1); ny = ocy + (ev.xmotion.y - y1); - if(abs(si->x_org + nx) < awesomeconf[screen].snap) - nx = si->x_org; - else if(abs((si->x_org + si->width) - (nx + c->w + 2 * c->border)) < awesomeconf[screen].snap) - nx = si->x_org + si->width - c->w - 2 * c->border; - if(abs(si->y_org - ny) < awesomeconf[screen].snap) - ny = si->y_org; - else if(abs((si->y_org + si->height) - (ny + c->h + 2 * c->border)) < awesomeconf[screen].snap) - ny = si->y_org + si->height - c->h - 2 * c->border; + if(abs(si[c->screen].x_org + nx) < awesomeconf[screen].snap) + nx = si[c->screen].x_org; + else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < awesomeconf[screen].snap) + nx = si[c->screen].x_org + si[c->screen].width - c->w - 2 * c->border; + if(abs(si[c->screen].y_org - ny) < awesomeconf[screen].snap) + ny = si[c->screen].y_org; + else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf[screen].snap) + ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border; resize(c, nx, ny, c->w, c->h, False); break; } diff --git a/layout.c b/layout.c index 7dd41d98..9d7e2e95 100644 --- a/layout.c +++ b/layout.c @@ -22,7 +22,7 @@ #include #include -#include "awesome.h" +#include "screen.h" #include "layout.h" #include "tag.h" #include "util.h" @@ -228,12 +228,13 @@ uicb_togglemax(Display *disp, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { - maximize(get_windows_area_x(awesomeconf->statusbar), - get_windows_area_y(awesomeconf->statusbar), - get_windows_area_width(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, - get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, - drawcontext, - awesomeconf); + int dummy; + ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, awesomeconf->statusbar, &dummy); + + maximize(si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org, + si[awesomeconf->screen].width - 2 * awesomeconf->borderpx, + si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, + drawcontext, awesomeconf); } void @@ -242,13 +243,13 @@ uicb_toggleverticalmax(Display *disp, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { + int dummy; + ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, awesomeconf->statusbar, &dummy); + if(sel) - maximize(sel->x, - get_windows_area_y(awesomeconf->statusbar), - sel->w, - get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, - drawcontext, - awesomeconf); + maximize(sel->x, si[awesomeconf->screen].y_org, + sel->w, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, + drawcontext, awesomeconf); } @@ -258,13 +259,13 @@ uicb_togglehorizontalmax(Display *disp, awesome_config *awesomeconf, const char *arg __attribute__ ((unused))) { + int dummy; + ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, awesomeconf->statusbar, &dummy); + if(sel) - maximize(get_windows_area_x(awesomeconf->statusbar), - sel->y, - get_windows_area_height(disp, awesomeconf->statusbar) - 2 * awesomeconf->borderpx, - sel->h, - drawcontext, - awesomeconf); + maximize(si[awesomeconf->screen].x_org, sel->y, + si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, sel->h, + drawcontext, awesomeconf); } void