Changeset e1f2079 in mainline for uspace/srv/hid/display


Ignore:
Timestamp:
2020-02-14T19:54:40Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b0a94854
Parents:
b252e87
Message:

Get display resolution by querying display device

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

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/ddev.c

    rb252e87 re1f2079  
    3737#include <ddev.h>
    3838#include <errno.h>
     39#include <io/log.h>
    3940#include <stdio.h>
    4041#include <stdlib.h>
     
    5354{
    5455        ds_ddev_t *ddev;
     56        ddev_info_t info;
    5557        gfx_context_t *gc;
    5658        ddev_t *dd = NULL;
     
    7173                return rc;
    7274        }
     75
     76        rc = ddev_get_info(dd, &info);
     77        if (rc != EOK) {
     78                printf("Error getting information for display device '%s'.\n",
     79                    name);
     80                free(name);
     81                ddev_close(dd);
     82                return rc;
     83        }
     84
     85        log_msg(LOG_DEFAULT, LVL_NOTE, "Device rectangle for '%s': "
     86            "%d,%d,%d,%d\n", name, info.rect.p0.x, info.rect.p0.y,
     87            info.rect.p1.x, info.rect.p1.y);
    7388
    7489        rc = ddev_get_gc(dd, &gc);
     
    91106        ddev->dd = dd;
    92107        ddev->gc = gc;
     108        ddev->info = info;
    93109
    94110        ds_display_add_ddev(display, ddev);
  • uspace/srv/hid/display/display.c

    rb252e87 re1f2079  
    384384        assert(!link_used(&ddev->lddevs));
    385385
     386        /* Set display dimensions to dimensions of first display device */
     387        if (gfx_rect_is_empty(&disp->rect))
     388                disp->rect = ddev->info.rect;
     389
    386390        ddev->display = disp;
    387391        list_append(&ddev->lddevs, &disp->ddevs);
     
    447451errno_t ds_display_paint_bg(ds_display_t *disp, gfx_rect_t *rect)
    448452{
    449         gfx_rect_t dsrect;
    450453        gfx_rect_t crect;
    451454        gfx_context_t *gc;
    452455        errno_t rc;
    453456
    454         dsrect.p0.x = 0;
    455         dsrect.p0.y = 0;
    456         dsrect.p1.x = 1024;
    457         dsrect.p1.y = 768;
    458 
    459457        if (rect != NULL)
    460                 gfx_rect_clip(&dsrect, rect, &crect);
     458                gfx_rect_clip(&disp->rect, rect, &crect);
    461459        else
    462                 crect = dsrect;
     460                crect = disp->rect;
    463461
    464462        gc = ds_display_get_gc(disp); // XXX
  • uspace/srv/hid/display/seat.c

    rb252e87 re1f2079  
    253253errno_t ds_seat_post_ptd_event(ds_seat_t *seat, ptd_event_t *event)
    254254{
     255        ds_display_t *disp = seat->display;
    255256        gfx_coord2_t npos;
    256257        ds_window_t *wnd;
     
    287288
    288289                gfx_coord2_add(&seat->pntpos, &event->dmove, &npos);
    289                 if (npos.x < 0)
    290                         npos.x = 0;
    291                 if (npos.y < 0)
    292                         npos.y = 0;
    293                 if (npos.x > 1024)
    294                         npos.x = 1024;
    295                 if (npos.y > 768)
    296                         npos.y = 768;
     290                gfx_coord2_clip(&npos, &disp->rect, &npos);
    297291
    298292                printf("clear pointer\n");
  • uspace/srv/hid/display/types/display/ddev.h

    rb252e87 re1f2079  
    5252        /** Device GC */
    5353        gfx_context_t *gc;
     54        /** Display device information */
     55        ddev_info_t info;
    5456        /** Service ID */
    5557        service_id_t svc_id;
  • uspace/srv/hid/display/types/display/display.h

    rb252e87 re1f2079  
    3939#include <adt/list.h>
    4040#include <gfx/color.h>
     41#include <gfx/coord.h>
    4142#include <io/input.h>
    4243#include "window.h"
     
    6970        /** Background color */
    7071        gfx_color_t *bg_color;
     72
     73        /** Bounding rectangle */
     74        gfx_rect_t rect;
    7175} ds_display_t;
    7276
Note: See TracChangeset for help on using the changeset viewer.