Changeset 8edec53 in mainline for uspace/app/nav/panel.c


Ignore:
Timestamp:
2021-10-25T17:51:10Z (2 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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        }
Note: See TracChangeset for help on using the changeset viewer.