X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=bb0772d722fd24a22987094448557325ccb77496;hb=65f0c708516d9db24d4d4517a9ecfc8882c1f337;hp=e4483e1f1a6769c21f7df302dccfaf12b0800af6;hpb=59d35252dd37170a84c053dbff0fa1020e44888f;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index e4483e1f..bb0772d7 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -218,10 +218,11 @@ static ObAppSettings *get_settings(ObClient *client) && !strcmp(app->name, client->name)) ) { ob_debug("Window matching: %s\n", app->name); - /* Match if no role was specified in the per app setting, or if the string - * matches the beginning of the role, since apps like to set the role to - * things like browser-window-23c4b2f */ - if (!app->role || !strncmp(app->role, client->role, strlen(app->role))) + /* Match if no role was specified in the per app setting, or if the + * string matches the beginning of the role, since apps like to set + * the role to things like browser-window-23c4b2f */ + if (!app->role + || !strncmp(app->role, client->role, strlen(app->role))) return app; } @@ -245,7 +246,8 @@ void client_manage(Window window) /* check if it has already been unmapped by the time we started mapping the grab does a sync so we don't have to here */ if (XCheckTypedWindowEvent(ob_display, window, DestroyNotify, &e) || - XCheckTypedWindowEvent(ob_display, window, UnmapNotify, &e)) { + XCheckTypedWindowEvent(ob_display, window, UnmapNotify, &e)) + { XPutBackEvent(ob_display, &e); grab_server(FALSE); @@ -254,7 +256,8 @@ void client_manage(Window window) /* make sure it isn't an override-redirect window */ if (!XGetWindowAttributes(ob_display, window, &attrib) || - attrib.override_redirect) { + attrib.override_redirect) + { grab_server(FALSE); return; /* don't manage it */ } @@ -262,7 +265,8 @@ void client_manage(Window window) /* is the window a docking app */ if ((wmhint = XGetWMHints(ob_display, window))) { if ((wmhint->flags & StateHint) && - wmhint->initial_state == WithdrawnState) { + wmhint->initial_state == WithdrawnState) + { dock_add(window, wmhint); grab_server(FALSE); XFree(wmhint); @@ -311,7 +315,7 @@ void client_manage(Window window) XChangeSaveSet(ob_display, window, SetModeInsert); /* create the decoration frame for the client window */ - self->frame = frame_new(); + self->frame = frame_new(self); frame_grab_client(self->frame, self); @@ -329,11 +333,11 @@ void client_manage(Window window) /* Don't worry, we won't actually both shade and undecorate the * window when push comes to shove. */ if (settings->shade != -1) - client_shade(self, settings->shade); + client_shade(self, !!settings->shade); if (settings->decor != -1) client_set_undecorated(self, !settings->decor); if (settings->iconic != -1) - client_iconify(self, settings->iconic, FALSE); + client_iconify(self, !!settings->iconic, FALSE); if (settings->skip_pager != -1) { self->skip_pager = !!settings->skip_pager; client_change_state(self); @@ -370,14 +374,17 @@ void client_manage(Window window) /* focus the new window? */ if (ob_state() != OB_STATE_STARTING && - (config_focus_new || client_search_focus_parent(self)) || - (settings && settings->focus == TRUE) && + /* this means focus=true for window is same as config_focus_new=true */ + ((config_focus_new || (settings && settings->focus == 1)) || + client_search_focus_parent(self)) && + /* this checks for focus=false for the window */ + (!settings || settings->focus != 0) && /* note the check against Type_Normal/Dialog, not client_normal(self), which would also include other types. in this case we want more strict rules for focus */ (self->type == OB_CLIENT_TYPE_NORMAL || self->type == OB_CLIENT_TYPE_DIALOG)) - { + { activate = TRUE; #if 0 if (self->desktop != screen_desktop) { @@ -474,7 +481,8 @@ void client_manage(Window window) g_hash_table_insert(window_map, &self->window, self); /* this has to happen after we're in the client_list */ - screen_update_areas(); + if (STRUT_EXISTS(self->strut)) + screen_update_areas(); /* update the list hints */ client_set_list(); @@ -521,7 +529,8 @@ void client_unmanage(ObClient *self) /* once the client is out of the list, update the struts to remove it's influence */ - screen_update_areas(); + if (STRUT_EXISTS(self->strut)) + screen_update_areas(); for (it = client_destructors; it; it = g_slist_next(it)) { Destructor *d = it->data; @@ -809,19 +818,21 @@ static void client_toggle_border(ObClient *self, gboolean show) static void client_get_all(ObClient *self) { client_get_area(self); - client_update_transient_for(self); - client_update_wmhints(self); - client_get_startup_id(self); - client_get_desktop(self); - client_get_shaped(self); - client_get_mwm_hints(self); - client_get_type(self);/* this can change the mwmhints for special cases */ /* The transient hint is used to pick a type, but the type can also affect - transiency (dialogs are always made transients). This is Havoc's idea, - but it is needed to make some apps work right (eg tsclient). */ + transiency (dialogs are always made transients of their group if they + have one). This is Havoc's idea, but it is needed to make some apps + work right (eg tsclient). */ client_update_transient_for(self); + client_get_type(self);/* this can change the mwmhints for special cases */ + client_update_transient_for(self); + + client_update_wmhints(self); + client_get_startup_id(self); + client_get_desktop(self);/* uses transient data/group/startup id if a + desktop is not specified */ + client_get_shaped(self); client_get_state(self); @@ -1302,6 +1313,7 @@ void client_setup_decor_and_functions(ObClient *self) if (! (self->mwmhints.decorations & OB_MWM_DECOR_ALL)) { if (! ((self->mwmhints.decorations & OB_MWM_DECOR_HANDLE) || (self->mwmhints.decorations & OB_MWM_DECOR_TITLE))) + { /* if the mwm hints request no handle or title, then all decorations are disabled, but keep the border if that's specified */ @@ -1309,6 +1321,7 @@ void client_setup_decor_and_functions(ObClient *self) self->decorations = OB_FRAME_DECOR_BORDER; else self->decorations = 0; + } } } @@ -2348,7 +2361,8 @@ static void client_iconify_recursive(ObClient *self, if (changed) { client_change_state(self); client_showhide(self); - screen_update_areas(); + if (STRUT_EXISTS(self->strut)) + screen_update_areas(); } /* iconify all transients */ @@ -2496,7 +2510,7 @@ void client_close(ObClient *self) ce.xclient.window = self->window; ce.xclient.format = 32; ce.xclient.data.l[0] = prop_atoms.wm_delete_window; - ce.xclient.data.l[1] = event_lasttime; + ce.xclient.data.l[1] = event_curtime; ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; @@ -2534,7 +2548,8 @@ void client_set_desktop_recursive(ObClient *self, /* raise if it was not already on the desktop */ if (old != DESKTOP_ALL) client_raise(self); - screen_update_areas(); + if (STRUT_EXISTS(self->strut)) + screen_update_areas(); /* add to the new desktop(s) */ if (config_focus_new) @@ -2817,7 +2832,7 @@ gboolean client_focus(ObClient *self) #799. So now it is RevertToNone again. */ XSetInputFocus(ob_display, self->window, RevertToNone, - event_lasttime); + event_curtime); } if (self->focus_notify) { @@ -2828,7 +2843,7 @@ gboolean client_focus(ObClient *self) ce.xclient.window = self->window; ce.xclient.format = 32; ce.xclient.data.l[0] = prop_atoms.wm_take_focus; - ce.xclient.data.l[1] = event_lasttime; + ce.xclient.data.l[1] = event_curtime; ce.xclient.data.l[2] = 0l; ce.xclient.data.l[3] = 0l; ce.xclient.data.l[4] = 0l; @@ -2838,7 +2853,7 @@ gboolean client_focus(ObClient *self) #ifdef DEBUG_FOCUS ob_debug("%sively focusing %lx at %d\n", (self->can_focus ? "act" : "pass"), - self->window, (gint) event_lasttime); + self->window, (gint) event_curtime); #endif /* Cause the FocusIn to come back to us. Important for desktop switches, @@ -2860,8 +2875,11 @@ void client_unfocus(ObClient *self) } } -void client_activate(ObClient *self, gboolean here) +void client_activate(ObClient *self, gboolean here, gboolean user) { + /* XXX do some stuff here if user is false to determine if we really want + to activate it or not (a parent or group member is currently active) */ + if (client_normal(self) && screen_showing_desktop) screen_show_desktop(FALSE); if (self->iconic) @@ -2996,8 +3014,8 @@ ObClient *client_find_directional(ObClient *c, ObDirection dir) continue; if(cur->iconic) continue; - if(client_focus_target(cur) == cur && - !(cur->can_focus || cur->focus_notify)) + if(!(client_focus_target(cur) == cur && + client_can_focus(cur))) continue; /* find the centre coords of this window, from the @@ -3274,7 +3292,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) his_edge_start = cur->frame->area.x; his_edge_end = cur->frame->area.x + cur->frame->area.width; - his_offset = cur->frame->area.y + (hang ? 0 : cur->frame->area.height); + his_offset = cur->frame->area.y + + (hang ? 0 : cur->frame->area.height); if(his_offset + 1 > my_offset) continue; @@ -3292,7 +3311,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) /* default: bottom of screen */ dest = a->y + a->height - (hang ? c->frame->area.height : 0); - monitor_dest = monitor->y + monitor->height - (hang ? c->frame->area.height : 0); + monitor_dest = monitor->y + monitor->height - + (hang ? c->frame->area.height : 0); /* if the monitor edge comes before the screen edge, */ /* use that as the destination instead. (For xinerama) */ if (monitor_dest != dest && my_offset < monitor_dest) @@ -3306,7 +3326,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) his_edge_start = cur->frame->area.x; his_edge_end = cur->frame->area.x + cur->frame->area.width; - his_offset = cur->frame->area.y + (hang ? cur->frame->area.height : 0); + his_offset = cur->frame->area.y + + (hang ? cur->frame->area.height : 0); if(his_offset - 1 < my_offset) @@ -3339,7 +3360,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) his_edge_start = cur->frame->area.y; his_edge_end = cur->frame->area.y + cur->frame->area.height; - his_offset = cur->frame->area.x + (hang ? 0 : cur->frame->area.width); + his_offset = cur->frame->area.x + + (hang ? 0 : cur->frame->area.width); if(his_offset + 1 > my_offset) continue; @@ -3357,7 +3379,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) /* default: rightmost edge of screen */ dest = a->x + a->width - (hang ? c->frame->area.width : 0); - monitor_dest = monitor->x + monitor->width - (hang ? c->frame->area.width : 0); + monitor_dest = monitor->x + monitor->width - + (hang ? c->frame->area.width : 0); /* if the monitor edge comes before the screen edge, */ /* use that as the destination instead. (For xinerama) */ if (monitor_dest != dest && my_offset < monitor_dest) @@ -3371,7 +3394,8 @@ gint client_directional_edge_search(ObClient *c, ObDirection dir, gboolean hang) his_edge_start = cur->frame->area.y; his_edge_end = cur->frame->area.y + cur->frame->area.height; - his_offset = cur->frame->area.x + (hang ? cur->frame->area.width : 0); + his_offset = cur->frame->area.x + + (hang ? cur->frame->area.width : 0); if(his_offset - 1 < my_offset) continue;