X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=209e5397c8f103523ad51bf9798acf2fadeb33e7;hb=a43303bdcbb5460f8d50823c4d0cedc30de6bb57;hp=59af202a6d426a9b28d14eb41da3c36026161ad7;hpb=3e9d050ffe36fa08c1e3e6f610c4d6587d2fdadd;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 59af202a..209e5397 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1,3 +1,21 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + client.c for the Openbox window manager + 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 "client.h" #include "debug.h" #include "startupnotify.h" @@ -165,9 +183,6 @@ void client_manage_all() } } XFree(children); - - if (config_focus_new) - focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); } void client_manage(Window window) @@ -1942,8 +1957,8 @@ void client_configure_full(ObClient *self, ObCorner anchor, (resized && config_redraw_resize)))); /* if the client is enlarging, the resize the client before the frame */ - if (send_resize_client && (w > oldw || h > oldh)) - XResizeWindow(ob_display, self->window, MAX(w, oldw), MAX(h, oldh)); + if (send_resize_client && user && (w > oldw || h > oldh)) + XResizeWindow(ob_display, self->window, MAX(w, oldw), MAX(h, oldh)); /* move/resize the frame to match the request */ if (self->frame) { @@ -1973,12 +1988,12 @@ void client_configure_full(ObClient *self, ObCorner anchor, event.xconfigure.override_redirect = FALSE; XSendEvent(event.xconfigure.display, event.xconfigure.window, FALSE, StructureNotifyMask, &event); - } + } } /* if the client is shrinking, then resize the frame before the client */ - if (send_resize_client && (w <= oldw || h <= oldh)) - XResizeWindow(ob_display, self->window, w, h); + if (send_resize_client && (!user || (w <= oldw || h <= oldh))) + XResizeWindow(ob_display, self->window, w, h); XFlush(ob_display); } @@ -2576,11 +2591,12 @@ gboolean client_focus(ObClient *self) void client_unfocus(ObClient *self) { - g_assert(focus_client == self); + if (focus_client == self) { #ifdef DEBUG_FOCUS - ob_debug("client_unfocus for %lx\n", self->window); + ob_debug("client_unfocus for %lx\n", self->window); #endif - focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); + focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); + } } void client_activate(ObClient *self, gboolean here) @@ -2998,3 +3014,24 @@ int client_directional_edge_search(ObClient *c, ObDirection dir) } return dest; } + +ObClient* client_under_pointer() +{ + int x, y; + GList *it; + ObClient *ret = NULL; + + if (screen_pointer_pos(&x, &y)) { + for (it = stacking_list; it != NULL; it = it->next) { + if (WINDOW_IS_CLIENT(it->data)) { + ObClient *c = WINDOW_AS_CLIENT(it->data); + if (c->desktop == screen_desktop && + RECT_CONTAINS(c->frame->area, x, y)) { + ret = c; + break; + } + } + } + } + return ret; +}