Changeset ebb1489 in mainline for uspace/srv/hid/console/console.c


Ignore:
Timestamp:
2024-10-13T08:23:40Z (8 weeks ago)
Author:
GitHub <noreply@…>
Children:
0472cf17
Parents:
2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
git-committer:
GitHub <noreply@…> (2024-10-13 08:23:40)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    r2a0c827c rebb1489  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * Copyright (c) 2011 Martin Decky
    44 * All rights reserved.
     
    334334{
    335335        /* Got key press/release event */
    336         cons_event_t *event =
    337             (cons_event_t *) malloc(sizeof(cons_event_t));
     336        cons_qevent_t *event =
     337            (cons_qevent_t *) malloc(sizeof(cons_qevent_t));
    338338        if (event == NULL)
    339339                return;
    340340
    341         *event = *ev;
     341        event->ev = *ev;
    342342        link_initialize(&event->link);
    343343
     
    366366{
    367367        cons_event_t event;
    368 
     368        bool alt;
     369        bool shift;
     370
     371        alt = (mods & KM_ALT) != 0 && (mods & (KM_CTRL | KM_SHIFT)) == 0;
     372        shift = (mods & KM_SHIFT) != 0 && (mods & (KM_CTRL | KM_ALT)) == 0;
     373
     374        /* Switch console on Alt+Fn or Shift+Fn */
    369375        if ((key >= KC_F1) && (key <= KC_F1 + CONSOLE_COUNT) &&
    370             ((mods & KM_CTRL) == 0)) {
     376            (alt || shift)) {
    371377                cons_switch(key - KC_F1);
    372378        } else {
     
    550556                if (pos < size) {
    551557                        link_t *link = prodcons_consume(&cons->input_pc);
    552                         cons_event_t *event = list_get_instance(link,
    553                             cons_event_t, link);
     558                        cons_qevent_t *qevent = list_get_instance(link,
     559                            cons_qevent_t, link);
     560                        cons_event_t *event = &qevent->ev;
    554561
    555562                        /* Accept key presses of printable chars only. */
     
    561568                        }
    562569
    563                         free(event);
     570                        free(qevent);
    564571                }
    565572        }
     
    697704        console_t *cons = srv_to_console(srv);
    698705        link_t *link = prodcons_consume(&cons->input_pc);
    699         cons_event_t *cevent = list_get_instance(link, cons_event_t, link);
    700 
    701         *event = *cevent;
    702         free(cevent);
     706        cons_qevent_t *qevent = list_get_instance(link, cons_qevent_t, link);
     707
     708        *event = qevent->ev;
     709        free(qevent);
    703710        return EOK;
    704711}
Note: See TracChangeset for help on using the changeset viewer.