Changeset 46a47c0 in mainline for uspace/lib/display
- Timestamp:
- 2023-01-16T20:34:01Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0ae23f
- Parents:
- b3eeae5
- Location:
- uspace/lib/display
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/include/types/display.h
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 60 60 void (*close_event)(void *); 61 61 /** Focus event */ 62 void (*focus_event)(void * );62 void (*focus_event)(void *, unsigned); 63 63 /** Keyboard event */ 64 64 void (*kbd_event)(void *, kbd_event_t *); … … 68 68 void (*resize_event)(void *, gfx_rect_t *); 69 69 /** Unfocus event */ 70 void (*unfocus_event)(void * );70 void (*unfocus_event)(void *, unsigned); 71 71 } display_wnd_cb_t; 72 72 -
uspace/lib/display/include/types/display/event.h
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 56 56 } display_wnd_ev_type_t; 57 57 58 /** Display window focus event */ 59 typedef struct { 60 /** New number of foci */ 61 unsigned nfocus; 62 } display_wnd_focus_ev_t; 63 58 64 /** Display window resize event */ 59 65 typedef struct { 60 66 gfx_rect_t rect; 61 67 } display_wnd_resize_ev_t; 68 69 /** Display window unfocus event */ 70 typedef struct { 71 /** Number of remaining foci */ 72 unsigned nfocus; 73 } display_wnd_unfocus_ev_t; 62 74 63 75 /** Display window event */ … … 66 78 display_wnd_ev_type_t etype; 67 79 union { 80 /** Focus event data */ 81 display_wnd_focus_ev_t focus; 68 82 /** Keyboard event data */ 69 83 kbd_event_t kbd; … … 72 86 /** Resize event data */ 73 87 display_wnd_resize_ev_t resize; 88 /** Unfocus event data */ 89 display_wnd_unfocus_ev_t unfocus; 74 90 } ev; 75 91 } display_wnd_ev_t; -
uspace/lib/display/src/display.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 716 716 case wev_focus: 717 717 if (window->cb != NULL && window->cb->focus_event != NULL) { 718 window->cb->focus_event(window->cb_arg); 718 window->cb->focus_event(window->cb_arg, 719 event.ev.focus.nfocus); 719 720 } 720 721 break; … … 739 740 case wev_unfocus: 740 741 if (window->cb != NULL && window->cb->unfocus_event != NULL) { 741 window->cb->unfocus_event(window->cb_arg); 742 window->cb->unfocus_event(window->cb_arg, 743 event.ev.unfocus.nfocus); 742 744 } 743 745 break; -
uspace/lib/display/test/display.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 51 51 52 52 static void test_close_event(void *); 53 static void test_focus_event(void * );53 static void test_focus_event(void *, unsigned); 54 54 static void test_kbd_event(void *, kbd_event_t *); 55 55 static void test_pos_event(void *, pos_event_t *); 56 static void test_unfocus_event(void * );56 static void test_unfocus_event(void *, unsigned); 57 57 58 58 static errno_t test_window_create(void *, display_wnd_params_t *, sysarg_t *); … … 166 166 bool set_color_called; 167 167 bool close_event_called; 168 168 169 bool focus_event_called; 169 170 bool kbd_event_called; … … 1677 1678 resp.event_cnt = 1; 1678 1679 resp.event.etype = wev_focus; 1680 resp.event.ev.focus.nfocus = 42; 1679 1681 resp.wnd_id = wnd->id; 1680 1682 resp.focus_event_called = false; … … 1693 1695 PCUT_ASSERT_INT_EQUALS(resp.event.etype, 1694 1696 resp.revent.etype); 1697 PCUT_ASSERT_INT_EQUALS(resp.event.ev.focus.nfocus, 1698 resp.revent.ev.focus.nfocus); 1695 1699 1696 1700 rc = display_window_destroy(wnd); … … 1896 1900 resp.event_cnt = 1; 1897 1901 resp.event.etype = wev_unfocus; 1902 resp.event.ev.unfocus.nfocus = 42; 1898 1903 resp.wnd_id = wnd->id; 1899 1904 resp.unfocus_event_called = false; … … 1912 1917 PCUT_ASSERT_INT_EQUALS(resp.event.etype, 1913 1918 resp.revent.etype); 1919 PCUT_ASSERT_INT_EQUALS(resp.event.ev.focus.nfocus, 1920 resp.revent.ev.focus.nfocus); 1914 1921 1915 1922 rc = display_window_destroy(wnd); … … 2057 2064 } 2058 2065 2059 static void test_focus_event(void *arg )2066 static void test_focus_event(void *arg, unsigned nfocus) 2060 2067 { 2061 2068 test_response_t *resp = (test_response_t *) arg; 2062 2069 2063 2070 resp->revent.etype = wev_focus; 2071 resp->revent.ev.focus.nfocus = nfocus; 2064 2072 2065 2073 fibril_mutex_lock(&resp->event_lock); … … 2095 2103 } 2096 2104 2097 static void test_unfocus_event(void *arg )2105 static void test_unfocus_event(void *arg, unsigned nfocus) 2098 2106 { 2099 2107 test_response_t *resp = (test_response_t *) arg; 2100 2108 2101 2109 resp->revent.etype = wev_unfocus; 2110 resp->revent.ev.unfocus.nfocus = nfocus; 2102 2111 2103 2112 fibril_mutex_lock(&resp->event_lock);
Note:
See TracChangeset
for help on using the changeset viewer.