Changeset 9b502dd in mainline for uspace/srv/hid/display


Ignore:
Timestamp:
2020-03-15T18:16:58Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b3825aa
Parents:
03c8081
Message:

Maintain minimum window size in display server

Location:
uspace/srv/hid/display
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/types/display/window.h

    r03c8081 r9b502dd  
    7070        /** Display position */
    7171        gfx_coord2_t dpos;
     72        /** Minimum size */
     73        gfx_coord2_t min_size;
    7274        /** Window ID */
    7375        ds_wnd_id_t id;
  • uspace/srv/hid/display/window.c

    r03c8081 r9b502dd  
    4343#include <io/log.h>
    4444#include <io/pixelmap.h>
     45#include <macros.h>
    4546#include <stdlib.h>
    4647#include "client.h"
     
    302303
    303304        wnd->rect = params->rect;
     305        wnd->min_size = params->min_size;
    304306        wnd->gc = gc;
    305307        *rgc = wnd;
     
    750752    gfx_rect_t *nrect)
    751753{
    752         *nrect = wnd->rect;
    753 
    754         if ((wnd->rsztype & display_wr_top) != 0)
    755                 nrect->p0.y += dresize->y;
    756         if ((wnd->rsztype & display_wr_left) != 0)
    757                 nrect->p0.x += dresize->x;
    758         if ((wnd->rsztype & display_wr_bottom) != 0)
    759                 nrect->p1.y += dresize->y;
    760         if ((wnd->rsztype & display_wr_right) != 0)
    761                 nrect->p1.x += dresize->x;
     754        if ((wnd->rsztype & display_wr_top) != 0) {
     755                nrect->p0.y = min(wnd->rect.p0.y + dresize->y,
     756                    wnd->rect.p1.y - wnd->min_size.y);
     757        } else {
     758                nrect->p0.y = wnd->rect.p0.y;
     759        }
     760
     761        if ((wnd->rsztype & display_wr_left) != 0) {
     762                nrect->p0.x = min(wnd->rect.p0.x + dresize->x,
     763                    wnd->rect.p1.x - wnd->min_size.x);
     764        } else {
     765                nrect->p0.x = wnd->rect.p0.x;
     766        }
     767
     768        if ((wnd->rsztype & display_wr_bottom) != 0) {
     769                nrect->p1.y = max(wnd->rect.p1.y + dresize->y,
     770                    wnd->rect.p0.y + wnd->min_size.y);
     771        } else {
     772                nrect->p1.y = wnd->rect.p1.y;
     773        }
     774
     775        if ((wnd->rsztype & display_wr_right) != 0) {
     776                nrect->p1.x = max(wnd->rect.p1.x + dresize->x,
     777                    wnd->rect.p0.x + wnd->min_size.x);
     778        } else {
     779                nrect->p1.x = wnd->rect.p1.x;
     780        }
    762781}
    763782
Note: See TracChangeset for help on using the changeset viewer.