X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=4ac234d73315a9d3137078f70c0643e3a99f4249;hb=8fe0cb8989c1fe12b30b9030b446345f25340d35;hp=aec05d6f96fb7f28a0755cb13c42d6c020a5ec78;hpb=3942d579d8423e994e29f6a5e80ed8021459d978;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index aec05d6f..4ac234d7 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -660,8 +660,6 @@ static void client_get_all(ObClient *self) client_get_state(self); client_get_shaped(self); - g_message("self->iconic %d", self->iconic); - client_get_mwm_hints(self); client_get_type(self);/* this can change the mwmhints for special cases */ @@ -1308,10 +1306,11 @@ void client_update_title(ObClient *self) GList *it; guint32 nums; guint i; - char *data = NULL; + gchar *data = NULL; gboolean read_title; + gchar *old_title; - g_free(self->title); + old_title = self->title; /* try netwm */ if (!PROP_GETS(self->window, net_wm_name, utf8, &data)) @@ -1319,6 +1318,10 @@ void client_update_title(ObClient *self) if (!PROP_GETS(self->window, wm_name, locale, &data)) data = g_strdup("Unnamed Window"); + /* did the title change? then reset the title_count */ + if (old_title && 0 != strncmp(old_title, data, strlen(data))) + self->title_count = 1; + /* look for duplicates and append a number */ nums = 0; for (it = client_list; it; it = it->next) @@ -1336,12 +1339,10 @@ void client_update_title(ObClient *self) } /* dont display the number for the first window */ if (self->title_count > 1) { - char *vdata, *ndata; - ndata = g_strdup_printf(" - [%u]", self->title_count); - vdata = g_strconcat(data, ndata, NULL); - g_free(ndata); + char *ndata; + ndata = g_strdup_printf("%s - [%u]", data, self->title_count); g_free(data); - data = vdata; + data = ndata; } PROP_SETS(self->window, net_wm_visible_name, data); @@ -1351,6 +1352,8 @@ void client_update_title(ObClient *self) if (self->frame) frame_adjust_title(self->frame); + g_free(old_title); + /* update the icon title */ data = NULL; g_free(self->icon_title); @@ -1710,7 +1713,6 @@ static void client_apply_startup_state(ObClient *self) { /* these are in a carefully crafted order.. */ - g_message("self->iconic %d", self->iconic); if (self->iconic) { self->iconic = FALSE; client_iconify(self, TRUE, FALSE); @@ -1751,6 +1753,8 @@ void client_configure_full(ObClient *self, ObCorner anchor, gboolean user, gboolean final, gboolean force_reply) { + gint oldw, oldh; + gboolean send_resize_client; gboolean moved = FALSE, resized = FALSE; guint fdecor = self->frame->decorations; gboolean fhorz = self->frame->max_horz; @@ -1912,14 +1916,20 @@ void client_configure_full(ObClient *self, ObCorner anchor, moved = x != self->area.x || y != self->area.y; resized = w != self->area.width || h != self->area.height; + oldw = self->area.width; + oldh = self->area.height; RECT_SET(self->area, x, y, w, h); /* for app-requested resizes, always resize if 'resized' is true. for user-requested ones, only resize if final is true, or when resizing in redraw mode */ - if ((!user && resized) || - (user && (final || (resized && config_redraw_resize)))) - XResizeWindow(ob_display, self->window, w, h); + send_resize_client = ((!user && resized) || + (user && (final || + (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)); /* move/resize the frame to match the request */ if (self->frame) { @@ -1951,6 +1961,12 @@ void client_configure_full(ObClient *self, ObCorner anchor, 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); + + XFlush(ob_display); } void client_fullscreen(ObClient *self, gboolean fs, gboolean savearea)