Mercurial > pidgin.yaz
comparison console/libgnt/gntwidget.c @ 14292:c111a7e718d0
[gaim-migrate @ 16982]
Make sure new windows fit in the screen.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 22 Aug 2006 17:02:20 +0000 |
parents | a0b1ab181316 |
children | 6e2e9e84b99d |
comparison
equal
deleted
inserted
replaced
14291:bfe84e01626f | 14292:c111a7e718d0 |
---|---|
329 if (!gnt_widget_has_shadow(widget)) | 329 if (!gnt_widget_has_shadow(widget)) |
330 shadow = FALSE; | 330 shadow = FALSE; |
331 | 331 |
332 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, | 332 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, |
333 widget->priv.y, widget->priv.x); | 333 widget->priv.y, widget->priv.x); |
334 if (widget->window == NULL) /* The size is probably too large for the screen */ | |
335 { | |
336 int x = widget->priv.x, y = widget->priv.y; | |
337 int w = widget->priv.width + shadow, h = widget->priv.height + shadow; | |
338 int maxx, maxy; /* Max-X is cool */ | |
339 | |
340 getmaxyx(stdscr, maxy, maxx); | |
341 | |
342 if (x + w >= maxx) | |
343 x = MAX(0, maxx - w); | |
344 if (y + h >= maxy) | |
345 y = MAX(0, maxy - h); | |
346 | |
347 w = MIN(w, maxx); | |
348 h = MIN(h, maxy); | |
349 | |
350 widget->priv.x = x; | |
351 widget->priv.y = y; | |
352 widget->priv.width = w - shadow; | |
353 widget->priv.height = h - shadow; | |
354 | |
355 widget->window = newwin(widget->priv.height + shadow, widget->priv.width + shadow, | |
356 widget->priv.y, widget->priv.x); | |
357 } | |
334 init_widget(widget); | 358 init_widget(widget); |
335 } | 359 } |
336 | 360 |
337 g_signal_emit(widget, signals[SIG_DRAW], 0); | 361 g_signal_emit(widget, signals[SIG_DRAW], 0); |
338 gnt_widget_queue_update(widget); | 362 gnt_widget_queue_update(widget); |