comparison console/libgnt/gntwidget.c @ 14932:94c69d2efae5

[gaim-migrate @ 17704] Fix some weird cases where the widgets are packed incorrectly in a box. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 08 Nov 2006 05:22:38 +0000
parents 056c8a27668c
children 7589733ba1aa
comparison
equal deleted inserted replaced
14931:d7732681329b 14932:94c69d2efae5
320 } 320 }
321 321
322 if (widget->window == NULL) 322 if (widget->window == NULL)
323 { 323 {
324 int x, y, maxx, maxy, w, h; 324 int x, y, maxx, maxy, w, h;
325 int oldw, oldh;
325 gboolean shadow = TRUE; 326 gboolean shadow = TRUE;
326 327
327 if (!gnt_widget_has_shadow(widget)) 328 if (!gnt_widget_has_shadow(widget))
328 shadow = FALSE; 329 shadow = FALSE;
329 330
330 x = widget->priv.x; 331 x = widget->priv.x;
331 y = widget->priv.y; 332 y = widget->priv.y;
332 w = widget->priv.width + shadow; 333 w = oldw = widget->priv.width + shadow;
333 h = widget->priv.height + shadow; 334 h = oldh = widget->priv.height + shadow;
334 335
335 getmaxyx(stdscr, maxy, maxx); 336 getmaxyx(stdscr, maxy, maxx);
336 maxy -= 1; /* room for the taskbar */ 337 maxy -= 1; /* room for the taskbar */
337 338
338 x = MAX(0, x); 339 x = MAX(0, x);
345 w = MIN(w, maxx); 346 w = MIN(w, maxx);
346 h = MIN(h, maxy); 347 h = MIN(h, maxy);
347 348
348 widget->priv.x = x; 349 widget->priv.x = x;
349 widget->priv.y = y; 350 widget->priv.y = y;
350 widget->priv.width = w - shadow; 351 if (w != oldw || h != oldh) {
351 widget->priv.height = h - shadow; 352 widget->priv.width = w - shadow;
353 widget->priv.height = h - shadow;
354 g_signal_emit(widget, signals[SIG_SIZE_CHANGED], 0, oldw, oldh);
355 }
352 356
353 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, 357 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow,
354 widget->priv.y, widget->priv.x); 358 widget->priv.y, widget->priv.x);
355 init_widget(widget); 359 init_widget(widget);
356 } 360 }