X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fpopup.c;h=fb7c90950bc2177fffcd4611444641ec2fbe2f7e;hb=ed4c6995ca199e5d015f1ca90654b4030c7ea760;hp=8521de6a46100a66e0a8522b475c05ec28bacd59;hpb=0242bc2ec8a6e9227cad30fcc4e12267a895b7c2;p=chaz%2Fopenbox diff --git a/openbox/popup.c b/openbox/popup.c index 8521de6a..fb7c9095 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -1,3 +1,22 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + popup.c for the Openbox window manager + Copyright (c) 2004 Mikael Magnusson + Copyright (c) 2003 Ben Jansens + + 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. + + See the COPYING file for a copy of the GNU General Public License. +*/ + #include "popup.h" #include "openbox.h" @@ -87,6 +106,12 @@ void popup_show(ObPopup *self, gchar *text) gint x, y, w, h; gint textw, texth; gint iconw; + Rect *area; /* won't go outside this */ + + area = screen_physical_area(); /* XXX this should work quite + good, someone with xinerama, + and different resolutions on + screens? */ RrMargins(self->a_bg, &l, &t, &r, &b); @@ -152,6 +177,9 @@ void popup_show(ObPopup *self, gchar *text) break; } + x=MAX(MIN(x, area->width-w),0); + y=MAX(MIN(y, area->height-h),0); + /* set the windows/appearances up */ XMoveResizeWindow(ob_display, self->bg, x, y, w, h); @@ -230,7 +258,7 @@ void icon_popup_free(ObIconPopup *self) } void icon_popup_show(ObIconPopup *self, - gchar *text, struct _ObClientIcon *icon) + gchar *text, const ObClientIcon *icon) { if (icon) { self->a_icon->texture[0].type = RR_TEXTURE_RGBA;