Changeset 7a05d924 in mainline
- Timestamp:
- 2022-10-20T08:05:06Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7cc30e9
- Parents:
- 1766326
- git-author:
- Jiri Svoboda <jiri@…> (2022-10-19 18:04:42)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-10-20 08:05:06)
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar/taskbar.c
r1766326 r7a05d924 174 174 } 175 175 176 rc = wndlist_a ppend(taskbar->wndlist, "Text Editor");177 if (rc != EOK) { 178 printf("Error a dding window list entry.\n");176 rc = wndlist_attach_wm(taskbar->wndlist, taskbar->wndmgt); 177 if (rc != EOK) { 178 printf("Error attaching window management service.\n"); 179 179 goto error; 180 180 } -
uspace/app/taskbar/types/wndlist.h
r1766326 r7a05d924 42 42 #include <ui/fixed.h> 43 43 #include <ui/resource.h> 44 #include <wndmgt.h> 44 45 45 46 /** Taskbar window list entry */ … … 69 70 /** Window list entries (of wndlist_entry_t) */ 70 71 list_t entries; 72 73 /** Window management service */ 74 wndmgt_t *wndmgt; 71 75 } wndlist_t; 72 76 -
uspace/app/taskbar/wndlist.c
r1766326 r7a05d924 49 49 * @param res UI resource 50 50 * @param fixed Fixed layout to which buttons will be added 51 * @param wndmgt Window management service 51 52 * @param rwndlist Place to store pointer to new window list 52 53 * @return @c EOK on success or an error code … … 71 72 error: 72 73 return rc; 74 } 73 75 76 /** Attach window management service to window list. 77 * 78 * @param wndlist Window list 79 * @param rwndlist Place to store pointer to new window list 80 * @return @c EOK on success or an error code 81 */ 82 errno_t wndlist_attach_wm(wndlist_t *wndlist, wndmgt_t *wndmgt) 83 { 84 errno_t rc; 85 wndmgt_window_list_t *wlist = NULL; 86 wndmgt_window_info_t *winfo = NULL; 87 sysarg_t i; 88 89 rc = wndmgt_get_window_list(wndmgt, &wlist); 90 if (rc != EOK) 91 goto error; 92 93 for (i = 0; i < wlist->nwindows; i++) { 94 rc = wndmgt_get_window_info(wndmgt, wlist->windows[i], 95 &winfo); 96 if (rc != EOK) 97 goto error; 98 99 rc = wndlist_append(wndlist, winfo->caption); 100 if (rc != EOK) { 101 wndmgt_free_window_info(winfo); 102 goto error; 103 } 104 105 wndmgt_free_window_info(winfo); 106 } 107 108 wndlist->wndmgt = wndmgt; 109 return EOK; 110 error: 111 if (wlist != NULL) 112 wndmgt_free_window_list(wlist); 113 return rc; 74 114 } 75 115 … … 90 130 wndlist_entry_t *entry = NULL; 91 131 gfx_rect_t rect; 132 size_t nentries; 92 133 errno_t rc; 134 135 /* Number of existing entries */ 136 nentries = list_count(&wndlist->entries); 93 137 94 138 entry = calloc(1, sizeof(wndlist_entry_t)); … … 103 147 104 148 if (ui_resource_is_textmode(wndlist->res)) { 105 rect.p0.x = 9;149 rect.p0.x = 17 * nentries + 9; 106 150 rect.p0.y = 0; 107 rect.p1.x = 25;151 rect.p1.x = 17 * nentries + 25; 108 152 rect.p1.y = 1; 109 153 } else { 110 rect.p0.x = 90;154 rect.p0.x = 145 * nentries + 90; 111 155 rect.p0.y = 3; 112 rect.p1.x = 230;156 rect.p1.x = 145 * nentries + 230; 113 157 rect.p1.y = 29; 114 158 } -
uspace/app/taskbar/wndlist.h
r1766326 r7a05d924 40 40 #include <ui/fixed.h> 41 41 #include <ui/resource.h> 42 #include <wndmgt.h> 42 43 #include "types/wndlist.h" 43 44 44 45 extern errno_t wndlist_create(ui_resource_t *, ui_fixed_t *, wndlist_t **); 46 extern errno_t wndlist_attach_wm(wndlist_t *, wndmgt_t *); 45 47 extern void wndlist_destroy(wndlist_t *); 46 48 extern errno_t wndlist_append(wndlist_t *, const char *); -
uspace/lib/wndmgt/include/types/wndmgt.h
r1766326 r7a05d924 36 36 #define _LIBWNDMGT_TYPES_WNDMGT_H_ 37 37 38 #include <ipc/services.h> 38 39 #include <types/common.h> 39 40 40 41 /** Use the default window management service (argument to wndmgt_open() */ 41 #define WNDMGT_DEFAULT NULL42 #define WNDMGT_DEFAULT SERVICE_NAME_WNDMGT 42 43 43 44 struct wndmgt; -
uspace/srv/hid/display/main.c
r1766326 r7a05d924 242 242 static void display_wndmgt_conn(ipc_call_t *icall, void *arg) 243 243 { 244 ds_display_t *disp = (ds_display_t *) arg; 244 245 wndmgt_srv_t srv; 245 246 … … 247 248 wndmgt_srv_initialize(&srv); 248 249 srv.ops = &wndmgt_srv_ops; 249 srv.arg = NULL; // XXX250 srv.arg = disp; 250 251 251 252 /* Handle connection */ -
uspace/srv/hid/display/wmops.c
r1766326 r7a05d924 35 35 36 36 #include <errno.h> 37 //#include <io/log.h>37 #include <io/log.h> 38 38 #include <stdlib.h> 39 39 #include <str.h> 40 40 #include <wndmgt_srv.h> 41 //#include "client.h" 42 //#include "display.h" 43 //#include "dsops.h" 44 //#include "seat.h" 45 //#include "window.h" 41 #include "display.h" 46 42 47 43 static errno_t dispwm_get_window_list(void *, wndmgt_window_list_t **); … … 62 58 { 63 59 wndmgt_window_list_t *list; 60 ds_display_t *disp = (ds_display_t *)arg; 61 ds_window_t *wnd; 62 unsigned i; 63 64 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_window_list()"); 64 65 65 66 list = calloc(1, sizeof(wndmgt_window_list_t)); … … 67 68 return ENOMEM; 68 69 69 list->nwindows = 2; 70 list->windows = calloc(2, sizeof(sysarg_t)); 70 /* Count the number of windows */ 71 list->nwindows = 0; 72 wnd = ds_display_first_window(disp); 73 while (wnd != NULL) { 74 ++list->nwindows; 75 wnd = ds_display_next_window(wnd); 76 } 77 78 /* Allocate array for window IDs */ 79 list->windows = calloc(list->nwindows, sizeof(sysarg_t)); 71 80 if (list->windows == NULL) { 72 81 free(list); … … 74 83 } 75 84 76 list->windows[0] = 1; 77 list->windows[1] = 2; 85 /* Fill in window IDs */ 86 i = 0; 87 wnd = ds_display_first_window(disp); 88 while (wnd != NULL) { 89 list->windows[i++] = wnd->id; 90 wnd = ds_display_next_window(wnd); 91 } 78 92 79 93 *rlist = list; … … 84 98 wndmgt_window_info_t **rinfo) 85 99 { 100 86 101 /* ds_client_t *client = (ds_client_t *) arg; 87 102 ds_window_t *wnd; … … 101 116 wndmgt_window_info_t *info; 102 117 118 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_window_info()"); 119 103 120 info = calloc(1, sizeof(wndmgt_window_info_t)); 104 121 if (info == NULL) … … 117 134 static errno_t dispwm_activate_window(void *arg, sysarg_t wnd_id) 118 135 { 136 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_activate_window()"); 119 137 (void)arg; 120 138 (void)wnd_id; … … 124 142 static errno_t dispwm_close_window(void *arg, sysarg_t wnd_id) 125 143 { 144 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_close_window()"); 126 145 (void)arg; 127 146 (void)wnd_id;
Note:
See TracChangeset
for help on using the changeset viewer.