qulogic/libgnt

Fix size calculation when shadow is enabled.

2007-11-10, Sadrul Habib Chowdhury
52be4fd3caef
Parents f187489ecfff
Children b47858829a36
Fix size calculation when shadow is enabled.
Also, when the terminal is resized, the SIGWINCH callback needs to refresh
after endwin to get the correct new size of the terminal.
  • +0 -1
    gntwidget.c
  • +10 -16
    gntwm.c
  • --- a/gntwidget.c Sat Nov 10 04:52:20 2007 +0000
    +++ b/gntwidget.c Sat Nov 10 23:48:57 2007 +0000
    @@ -466,7 +466,6 @@
    *width = wid->priv.width + shadow;
    if (height)
    *height = wid->priv.height + shadow;
    -
    }
    static void
    --- a/gntwm.c Sat Nov 10 04:52:20 2007 +0000
    +++ b/gntwm.c Sat Nov 10 23:48:57 2007 +0000
    @@ -109,12 +109,10 @@
    gnt_wm_copy_win(GntWidget *widget, GntNode *node)
    {
    WINDOW *src, *dst;
    - int shadow;
    if (!node)
    return;
    src = widget->window;
    dst = node->window;
    - shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
    copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0);
    }
    @@ -1004,9 +1002,9 @@
    GntWM *wm = GNT_WM(bindable);
    endwin();
    + refresh();
    - g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL);
    - refresh();
    + g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, GINT_TO_POINTER(TRUE));
    g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
    update_screen(wm);
    gnt_ws_draw_taskbar(wm->cws, TRUE);
    @@ -1622,13 +1620,11 @@
    shadow = FALSE;
    x = widget->priv.x;
    y = widget->priv.y;
    - w = widget->priv.width;
    - h = widget->priv.height;
    + w = widget->priv.width + shadow;
    + h = widget->priv.height + shadow;
    - getmaxyx(stdscr, maxy, maxx);
    - maxy -= 1; /* room for the taskbar */
    - maxy -= shadow;
    - maxx -= shadow;
    + maxx = getmaxx(stdscr);
    + maxy = getmaxy(stdscr) - 1; /* room for the taskbar */
    x = MAX(0, x);
    y = MAX(0, y);
    @@ -1639,7 +1635,7 @@
    w = MIN(w, maxx);
    h = MIN(h, maxy);
    - node->window = newwin(h + shadow, w + shadow, y, x);
    + node->window = newwin(h, w, y, x);
    gnt_wm_copy_win(widget, node);
    }
    #endif
    @@ -1884,9 +1880,8 @@
    {
    gboolean ret = TRUE;
    GntNode *node;
    - int shadow;
    int maxx, maxy;
    -
    +
    while (widget->parent)
    widget = widget->parent;
    node = g_hash_table_lookup(wm->nodes, widget);
    @@ -1900,9 +1895,8 @@
    gnt_widget_set_size(widget, width, height);
    gnt_widget_draw(widget);
    - shadow = gnt_widget_has_shadow(widget) ? 1 : 0;
    - maxx = getmaxx(stdscr) - shadow;
    - maxy = getmaxy(stdscr) - 1 - shadow;
    + maxx = getmaxx(stdscr);
    + maxy = getmaxy(stdscr) - 1;
    height = MIN(height, maxy);
    width = MIN(width, maxx);
    wresize(node->window, height, width);