Changeset 290a0f0 in mainline for uspace/lib/gui/window.c


Ignore:
Timestamp:
2012-11-25T19:34:10Z (12 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa98b26a
Parents:
c4ebe02
Message:

Resolved Ticket #482 (Cannot see which window is active).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/window.c

    rc4ebe02 r290a0f0  
    6666
    6767static pixel_t border_color = PIXEL(255, 0, 0, 0);
    68 static pixel_t header_bgcolor = PIXEL(255, 25, 25, 112);
    69 static pixel_t header_fgcolor = PIXEL(255, 255, 255, 255);
     68static pixel_t header_bg_focus_color = PIXEL(255, 25, 25, 112);
     69static pixel_t header_fg_focus_color = PIXEL(255, 255, 255, 255);
     70static pixel_t header_bg_unfocus_color = PIXEL(255, 70, 130, 180);
     71static pixel_t header_fg_unfocus_color = PIXEL(255, 255, 255, 255);
    7072
    7173static void paint_internal(widget_t *w)
     
    9496            w->vpos + w->height - border_thickness, w->width, border_thickness);
    9597
    96         source_set_color(&source, header_bgcolor);
     98        source_set_color(&source,
     99            w->window->is_focused ? header_bg_focus_color : header_bg_unfocus_color);
    97100        drawctx_transfer(&drawctx,
    98101            w->hpos + border_thickness, w->vpos + border_thickness,
     
    106109        char cls_pict[] = "x";
    107110        font_get_box(&font, cls_pict, &cls_width, &cls_height);
    108         source_set_color(&source, header_fgcolor);
     111        source_set_color(&source,
     112            w->window->is_focused ? header_fg_focus_color : header_fg_unfocus_color);
    109113        sysarg_t cls_x = ((close_width - cls_width) / 2) + w->hpos + w->width -
    110114            border_thickness - close_width;
     
    447451                        break;
    448452                case ET_POSITION_EVENT:
     453                        if (!win->is_focused) {
     454                                win->is_focused = true;
     455                                handle_refresh(win);
     456                        }
    449457                        deliver_position_event(win, event->data.pos);
    450458                        break;
     
    454462                case ET_WINDOW_RESIZE:
    455463                        handle_resize(win, event->data.rsz.width, event->data.rsz.height);
     464                        break;
     465                case ET_WINDOW_FOCUS:
     466                        if (!win->is_focused) {
     467                                win->is_focused = true;
     468                                handle_refresh(win);
     469                        }
     470                        break;
     471                case ET_WINDOW_UNFOCUS:
     472                        if (win->is_focused) {
     473                                win->is_focused = false;
     474                                handle_refresh(win);
     475                        }
    456476                        break;
    457477                case ET_WINDOW_REFRESH:
     
    525545        win->is_main = is_main;
    526546        win->is_decorated = is_decorated;
     547        win->is_focused = true;
    527548        prodcons_initialize(&win->events);
    528549        fibril_mutex_initialize(&win->guard);
Note: See TracChangeset for help on using the changeset viewer.