Ignore:
File:
1 edited

Legend:

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

    r21eeb653 r6d5e378  
    3434 */
    3535
    36 #include <stdbool.h>
     36#include <bool.h>
    3737#include <errno.h>
    3838#include <stdio.h>
     
    6666
    6767static pixel_t border_color = PIXEL(255, 0, 0, 0);
    68 static pixel_t header_bg_focus_color = PIXEL(255, 25, 25, 112);
    69 static pixel_t header_fg_focus_color = PIXEL(255, 255, 255, 255);
    70 static pixel_t header_bg_unfocus_color = PIXEL(255, 70, 130, 180);
    71 static pixel_t header_fg_unfocus_color = PIXEL(255, 255, 255, 255);
     68static pixel_t header_bgcolor = PIXEL(255, 25, 25, 112);
     69static pixel_t header_fgcolor = PIXEL(255, 255, 255, 255);
    7270
    7371static void paint_internal(widget_t *w)
     
    9694            w->vpos + w->height - border_thickness, w->width, border_thickness);
    9795
    98         source_set_color(&source,
    99             w->window->is_focused ? header_bg_focus_color : header_bg_unfocus_color);
     96        source_set_color(&source, header_bgcolor);
    10097        drawctx_transfer(&drawctx,
    10198            w->hpos + border_thickness, w->vpos + border_thickness,
     
    109106        char cls_pict[] = "x";
    110107        font_get_box(&font, cls_pict, &cls_width, &cls_height);
    111         source_set_color(&source,
    112             w->window->is_focused ? header_fg_focus_color : header_fg_unfocus_color);
     108        source_set_color(&source, header_fgcolor);
    113109        sysarg_t cls_x = ((close_width - cls_width) / 2) + w->hpos + w->width -
    114110            border_thickness - close_width;
     
    424420
    425421        while (!list_empty(&win->events.list)) {
    426                 window_event_t *event = (window_event_t *) list_first(&win->events.list);
    427                 list_remove(&event->link);
    428                 free(event);
     422                list_remove(list_first(&win->events.list));
    429423        }
    430424
     
    453447                        break;
    454448                case ET_POSITION_EVENT:
    455                         if (!win->is_focused) {
    456                                 win->is_focused = true;
    457                                 handle_refresh(win);
    458                         }
    459449                        deliver_position_event(win, event->data.pos);
    460450                        break;
     
    464454                case ET_WINDOW_RESIZE:
    465455                        handle_resize(win, event->data.rsz.width, event->data.rsz.height);
    466                         break;
    467                 case ET_WINDOW_FOCUS:
    468                         if (!win->is_focused) {
    469                                 win->is_focused = true;
    470                                 handle_refresh(win);
    471                         }
    472                         break;
    473                 case ET_WINDOW_UNFOCUS:
    474                         if (win->is_focused) {
    475                                 win->is_focused = false;
    476                                 handle_refresh(win);
    477                         }
    478456                        break;
    479457                case ET_WINDOW_REFRESH:
     
    536514}
    537515
    538 window_t *window_open(char *winreg, bool is_main, bool is_decorated,
    539     const char *caption, sysarg_t x_offset, sysarg_t y_offset)
     516window_t *window_open(char *winreg, bool is_main, bool is_decorated, const char *caption)
    540517{
    541518        int rc;
     
    548525        win->is_main = is_main;
    549526        win->is_decorated = is_decorated;
    550         win->is_focused = true;
    551527        prodcons_initialize(&win->events);
    552528        fibril_mutex_initialize(&win->guard);
     
    581557        service_id_t out_dsid;
    582558       
    583         rc = win_register(reg_sess, &in_dsid, &out_dsid, x_offset, y_offset);
     559        rc = win_register(reg_sess, &in_dsid, &out_dsid);
    584560        async_hangup(reg_sess);
    585561        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.