Changeset 8edec53 in mainline for uspace/app


Ignore:
Timestamp:
2021-10-25T17:51:10Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
91ece11b
Parents:
805a149
Message:

Support double-click

Needed to open Navigator entries using the mouse.

Location:
uspace/app
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/nav/nav.c

    r805a149 r8edec53  
    130130        ui_wnd_params_t params;
    131131        gfx_rect_t rect;
     132        gfx_rect_t arect;
     133        gfx_coord_t pw;
    132134        unsigned i;
    133135        errno_t rc;
     
    155157
    156158        ui_window_set_cb(navigator->window, &window_cb, (void *) navigator);
     159        ui_window_get_app_rect(navigator->window, &arect);
    157160
    158161        rc = ui_fixed_create(&navigator->fixed);
     
    176179                return rc;
    177180        }
     181
     182        /* Panel width */
     183        pw = (arect.p1.x - arect.p0.x) / 2;
    178184
    179185        for (i = 0; i < 2; i++) {
     
    183189                        goto error;
    184190
    185                 rect.p0.x = 40 * i;
    186                 rect.p0.y = 1;
    187                 rect.p1.x = 40 * (i + 1);
    188                 rect.p1.y = 24;
     191                rect.p0.x = arect.p0.x + pw * i;
     192                rect.p0.y = arect.p0.y + 1;
     193                rect.p1.x = arect.p0.x + pw * (i + 1);
     194                rect.p1.y = arect.p1.y - 1;
    189195                panel_set_rect(navigator->panel[i], &rect);
    190196
  • uspace/app/nav/panel.c

    r805a149 r8edec53  
    351351                panel_activate_req(panel);
    352352
    353         if (event->type == POS_PRESS) {
    354                 irect.p0.x = panel->rect.p0.x + 1;
    355                 irect.p0.y = panel->rect.p0.y + 1;
    356                 irect.p1.x = panel->rect.p1.x - 1;
    357                 irect.p1.y = panel->rect.p1.y - 1;
    358 
     353        irect.p0.x = panel->rect.p0.x + 1;
     354        irect.p0.y = panel->rect.p0.y + 1;
     355        irect.p1.x = panel->rect.p1.x - 1;
     356        irect.p1.y = panel->rect.p1.y - 1;
     357
     358        if (event->type == POS_PRESS || event->type == POS_DCLICK) {
    359359                /* Did we click on one of the entries? */
    360360                if (gfx_pix_inside_rect(&pos, &irect)) {
     
    365365                        entry = panel_page_nth_entry(panel, n, &entry_idx);
    366366
    367                         /* Move to the entry found */
    368                         panel_cursor_move(panel, entry, entry_idx);
     367                        if (event->type == POS_PRESS) {
     368                                /* Move to the entry found */
     369                                panel_cursor_move(panel, entry, entry_idx);
     370                        } else {
     371                                /* event->type == POS_DCLICK */
     372                                panel_open(panel, entry);
     373                        }
    369374                } else {
    370                         /* It's in the border. Top or bottom half? */
    371                         if (pos.y >= (irect.p0.y + irect.p1.y) / 2)
    372                                 panel_page_down(panel);
    373                         else
    374                                 panel_page_up(panel);
     375                        /* It's in the border. */
     376                        if (event->type == POS_PRESS) {
     377                                /* Top or bottom half? */
     378                                if (pos.y >= (irect.p0.y + irect.p1.y) / 2)
     379                                        panel_page_down(panel);
     380                                else
     381                                        panel_page_up(panel);
     382                        }
    375383                }
    376384        }
  • uspace/app/nav/panel.h

    r805a149 r8edec53  
    8383extern void panel_activate_req(panel_t *);
    8484
    85 
    8685#endif
    8786
  • uspace/app/terminal/terminal.c

    r805a149 r8edec53  
    842842        sysarg_t sy = -term->off.y;
    843843
    844         if (event->type == POS_PRESS || event->type == POS_RELEASE) {
     844        if (event->type == POS_PRESS || event->type == POS_RELEASE ||
     845            event->type == POS_DCLICK) {
    845846                cevent.type = CEV_POS;
    846847                cevent.ev.pos.type = event->type;
Note: See TracChangeset for help on using the changeset viewer.