Changeset b279899 in mainline
- Timestamp:
- 2023-10-17T12:18:10Z (14 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d4643db
- Parents:
- 4030072
- git-author:
- Jiri Svoboda <jiri@…> (2023-10-16 18:17:59)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-10-17 12:18:10)
- Location:
- uspace
- Files:
-
- 1 added
- 1 deleted
- 5 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar/meson.build
r4030072 rb279899 27 27 # 28 28 29 deps = [ ' startmenu', 'ui', 'wndmgt' ]29 deps = [ 'tbarcfg', 'ui', 'wndmgt' ] 30 30 src = files( 31 31 'clock.c', … … 49 49 50 50 if install_nonessential_data 51 installed_data += { 'name': ' startmenu.sif', 'dir': '/cfg' }51 installed_data += { 'name': 'taskbar.sif', 'dir': '/cfg' } 52 52 endif -
uspace/app/taskbar/taskbar.c
r4030072 rb279899 201 201 } 202 202 203 rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/ startmenu.sif");203 rc = tbsmenu_load(taskbar->tbsmenu, "/cfg/taskbar.sif"); 204 204 if (rc != EOK) { 205 205 printf("Error loading start menu from '%s'.\n", 206 "/cfg/ startmenu.sif");206 "/cfg/taskbar.sif"); 207 207 goto error; 208 208 } -
uspace/app/taskbar/tbsmenu.c
r4030072 rb279899 34 34 35 35 #include <gfx/coord.h> 36 #include <startmenu/startmenu.h>37 36 #include <stdbool.h> 38 37 #include <stddef.h> … … 40 39 #include <str.h> 41 40 #include <task.h> 41 #include <tbarcfg/tbarcfg.h> 42 42 #include <ui/fixed.h> 43 43 #include <ui/menu.h> … … 127 127 { 128 128 tbsmenu_entry_t *tentry; 129 startmenu_t *smenu= NULL;130 s tartmenu_entry_t *sme;129 tbarcfg_t *tbcfg = NULL; 130 smenu_entry_t *sme; 131 131 const char *caption; 132 132 const char *cmd; 133 133 errno_t rc; 134 134 135 rc = startmenu_open(repopath, &smenu);136 if (rc != EOK) 137 goto error; 138 139 sme = startmenu_first(smenu);135 rc = tbarcfg_open(repopath, &tbcfg); 136 if (rc != EOK) 137 goto error; 138 139 sme = tbarcfg_smenu_first(tbcfg); 140 140 while (sme != NULL) { 141 caption = s tartmenu_entry_get_caption(sme);142 cmd = s tartmenu_entry_get_cmd(sme);141 caption = smenu_entry_get_caption(sme); 142 cmd = smenu_entry_get_cmd(sme); 143 143 144 144 rc = tbsmenu_add(tbsmenu, caption, cmd, &tentry); … … 148 148 (void)tentry; 149 149 150 sme = startmenu_next(sme);151 } 152 153 startmenu_close(smenu);150 sme = tbarcfg_smenu_next(sme); 151 } 152 153 tbarcfg_close(tbcfg); 154 154 return EOK; 155 155 error: 156 if ( smenu!= NULL)157 startmenu_close(smenu);156 if (tbcfg != NULL) 157 tbarcfg_close(tbcfg); 158 158 return rc; 159 159 } -
uspace/lib/meson.build
r4030072 rb279899 80 80 'scsi', 81 81 'sif', 82 ' startmenu',82 'tbarcfg', 83 83 'trackmod', 84 84 'untar', -
uspace/lib/tbarcfg/include/tbarcfg/tbarcfg.h
r4030072 rb279899 27 27 */ 28 28 29 /** @addtogroup lib startmenu29 /** @addtogroup libtbarcfg 30 30 * @{ 31 31 */ … … 34 34 */ 35 35 36 #ifndef _ STARTMENU_STARTMENU_H37 #define _ STARTMENU_STARTMENU_H36 #ifndef _TBARCFG_TBARCFG_H 37 #define _TBARCFG_TBARCFG_H 38 38 39 39 #include <errno.h> 40 #include <types/ startmenu/startmenu.h>40 #include <types/tbarcfg/tbarcfg.h> 41 41 42 extern errno_t startmenu_open(const char *, startmenu_t **);43 extern void startmenu_close(startmenu_t *);44 extern s tartmenu_entry_t *startmenu_first(startmenu_t *);45 extern s tartmenu_entry_t *startmenu_next(startmenu_entry_t *);46 extern const char *s tartmenu_entry_get_caption(startmenu_entry_t *);47 extern const char *s tartmenu_entry_get_cmd(startmenu_entry_t *);42 extern errno_t tbarcfg_open(const char *, tbarcfg_t **); 43 extern void tbarcfg_close(tbarcfg_t *); 44 extern smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *); 45 extern smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *); 46 extern const char *smenu_entry_get_caption(smenu_entry_t *); 47 extern const char *smenu_entry_get_cmd(smenu_entry_t *); 48 48 49 49 #endif -
uspace/lib/tbarcfg/include/types/tbarcfg/tbarcfg.h
r4030072 rb279899 27 27 */ 28 28 29 /** @addtogroup lib startmenu29 /** @addtogroup libtbarcfg 30 30 * @{ 31 31 */ … … 34 34 */ 35 35 36 #ifndef _ STARTMENU_TYPES_STARTMENU_H37 #define _ STARTMENU_TYPES_STARTMENU_H36 #ifndef _TBARCFG_TYPES_TBARCFG_H 37 #define _TBARCFG_TYPES_TBARCFG_H 38 38 39 struct startmenu;40 typedef struct startmenu startmenu_t;39 struct tbarcfg; 40 typedef struct tbarcfg tbarcfg_t; 41 41 42 struct s tartmenu_entry;43 typedef struct s tartmenu_entry startmenu_entry_t;42 struct smenu_entry; 43 typedef struct smenu_entry smenu_entry_t; 44 44 45 45 #endif -
uspace/lib/tbarcfg/meson.build
r4030072 rb279899 29 29 deps = [ 'sif' ] 30 30 src = files( 31 'src/ startmenu.c',31 'src/tbarcfg.c', 32 32 ) 33 33 34 34 test_src = files( 35 35 'test/main.c', 36 'test/ startmenu.c',36 'test/tbarcfg.c', 37 37 ) -
uspace/lib/tbarcfg/private/tbarcfg.h
r4030072 rb279899 27 27 */ 28 28 29 /** @addtogroup lib startmenu29 /** @addtogroup libtbarcfg 30 30 * @{ 31 31 */ 32 32 /** 33 * @file Start menu33 * @file Task bar configuration 34 34 * 35 35 */ 36 36 37 #ifndef _ STARTMENU_PRIVATE_STARTMENU_H38 #define _ STARTMENU_PRIVATE_STARTMENU_H37 #ifndef _TBARCFG_PRIVATE_TBARCFG_H 38 #define _TBARCFG_PRIVATE_TBARCFG_H 39 39 40 40 #include <adt/list.h> 41 41 #include <sif.h> 42 #include <types/ startmenu/startmenu.h>42 #include <types/tbarcfg/tbarcfg.h> 43 43 44 /** Start menu*/45 struct startmenu{46 /** List of entries (startmenu_entry_t) */44 /** Task bar configuration */ 45 struct tbarcfg { 46 /** List of start menu entries (smenu_entry_t) */ 47 47 list_t entries; 48 48 }; 49 49 50 50 /** Start menu entry */ 51 struct s tartmenu_entry {51 struct smenu_entry { 52 52 /** Containing start menu */ 53 struct startmenu*smenu;53 struct tbarcfg *smenu; 54 54 /** Link to @c smenu->entries */ 55 55 link_t lentries; … … 60 60 }; 61 61 62 extern errno_t s tartmenu_entry_create(startmenu_t *, const char *,62 extern errno_t smenu_entry_create(tbarcfg_t *, const char *, 63 63 const char *); 64 64 -
uspace/lib/tbarcfg/src/tbarcfg.c
r4030072 rb279899 27 27 */ 28 28 29 /** @addtogroup lib startmenu29 /** @addtogroup libtbarcfg 30 30 * @{ 31 31 */ 32 32 /** 33 * @file Start menu33 * @file Task bar configuration 34 34 */ 35 35 36 36 #include <errno.h> 37 37 #include <sif.h> 38 #include < startmenu/startmenu.h>38 #include <tbarcfg/tbarcfg.h> 39 39 #include <stdlib.h> 40 40 #include <str.h> 41 #include "../private/ startmenu.h"42 43 /** Open start menu.41 #include "../private/tbarcfg.h" 42 43 /** Open task bar configuration. 44 44 * 45 45 * @param repopath Pathname of the menu repository 46 * @param r smenu Place to store pointer to start menu46 * @param rtbcfg Place to store pointer to task bar configuration 47 47 * @return EOK on success or an error code 48 48 */ 49 errno_t startmenu_open(const char *repopath, startmenu_t **rsmenu)50 { 51 startmenu_t *smenu;49 errno_t tbarcfg_open(const char *repopath, tbarcfg_t **rtbcfg) 50 { 51 tbarcfg_t *tbcfg; 52 52 sif_sess_t *repo = NULL; 53 53 sif_node_t *rnode; … … 59 59 errno_t rc; 60 60 61 smenu = calloc(1, sizeof(startmenu_t));62 if ( smenu== NULL) {63 rc = ENOMEM; 64 goto error; 65 } 66 67 list_initialize(& smenu->entries);61 tbcfg = calloc(1, sizeof(tbarcfg_t)); 62 if (tbcfg == NULL) { 63 rc = ENOMEM; 64 goto error; 65 } 66 67 list_initialize(&tbcfg->entries); 68 68 69 69 rc = sif_open(repopath, &repo); … … 99 99 } 100 100 101 rc = s tartmenu_entry_create(smenu, caption, cmd);101 rc = smenu_entry_create(tbcfg, caption, cmd); 102 102 if (rc != EOK) 103 103 goto error; … … 106 106 } 107 107 108 *r smenu = smenu;108 *rtbcfg = tbcfg; 109 109 return EOK; 110 110 error: 111 111 if (repo != NULL) 112 112 sif_close(repo); 113 if ( smenu!= NULL)114 free( smenu);113 if (tbcfg != NULL) 114 free(tbcfg); 115 115 return rc; 116 116 } 117 117 118 /** Close start menu.119 * 120 * @param smenuStart menu121 */ 122 void startmenu_close(startmenu_t *smenu)118 /** Close task bar configuration. 119 * 120 * @param tbcfg Start menu 121 */ 122 void tbarcfg_close(tbarcfg_t *tbcfg) 123 123 { 124 124 } … … 126 126 /** Get first start menu entry. 127 127 * 128 * @param smenu Start menu128 * @param tbcfg Task bar configuration 129 129 * @return First entry or @c NULL if the menu is empty 130 130 */ 131 s tartmenu_entry_t *startmenu_first(startmenu_t *smenu)131 smenu_entry_t *tbarcfg_smenu_first(tbarcfg_t *tbcfg) 132 132 { 133 133 link_t *link; 134 134 135 link = list_first(& smenu->entries);135 link = list_first(&tbcfg->entries); 136 136 if (link == NULL) 137 137 return NULL; 138 138 139 return list_get_instance(link, s tartmenu_entry_t, lentries);139 return list_get_instance(link, smenu_entry_t, lentries); 140 140 } 141 141 … … 145 145 * @return Next entry or @c NULL if @a cur is the last entry 146 146 */ 147 s tartmenu_entry_t *startmenu_next(startmenu_entry_t *cur)147 smenu_entry_t *tbarcfg_smenu_next(smenu_entry_t *cur) 148 148 { 149 149 link_t *link; … … 153 153 return NULL; 154 154 155 return list_get_instance(link, s tartmenu_entry_t, lentries);155 return list_get_instance(link, smenu_entry_t, lentries); 156 156 } 157 157 … … 161 161 * @return Caption (with accelerator markup) 162 162 */ 163 const char *s tartmenu_entry_get_caption(startmenu_entry_t *entry)163 const char *smenu_entry_get_caption(smenu_entry_t *entry) 164 164 { 165 165 return entry->caption; … … 171 171 * @return Command to run 172 172 */ 173 const char *s tartmenu_entry_get_cmd(startmenu_entry_t *entry)173 const char *smenu_entry_get_cmd(smenu_entry_t *entry) 174 174 { 175 175 return entry->cmd; … … 184 184 * @param cmd Command to run 185 185 */ 186 errno_t s tartmenu_entry_create(startmenu_t *smenu, const char *caption,186 errno_t smenu_entry_create(tbarcfg_t *smenu, const char *caption, 187 187 const char *cmd) 188 188 { 189 s tartmenu_entry_t *entry;189 smenu_entry_t *entry; 190 190 errno_t rc; 191 191 192 entry = calloc(1, sizeof(s tartmenu_entry_t));192 entry = calloc(1, sizeof(smenu_entry_t)); 193 193 if (entry == NULL) { 194 194 rc = ENOMEM; -
uspace/lib/tbarcfg/test/main.c
r4030072 rb279899 31 31 PCUT_INIT; 32 32 33 PCUT_IMPORT( startmenu);33 PCUT_IMPORT(tbarcfg); 34 34 35 35 PCUT_MAIN(); -
uspace/lib/tbarcfg/test/tbarcfg.c
r4030072 rb279899 29 29 #include <errno.h> 30 30 #include <pcut/pcut.h> 31 #include < startmenu/startmenu.h>31 #include <tbarcfg/tbarcfg.h> 32 32 #include <stdio.h> 33 33 34 34 PCUT_INIT; 35 35 36 PCUT_TEST_SUITE( startmenu);36 PCUT_TEST_SUITE(tbarcfg); 37 37 38 /** Opening and closing start menu*/38 /** Opening and closing task bar configuration */ 39 39 PCUT_TEST(open_close) 40 40 { 41 41 errno_t rc; 42 startmenu_t *smenu;42 tbarcfg_t *tbcfg; 43 43 FILE *f; 44 44 int rv; … … 53 53 PCUT_ASSERT_INT_EQUALS(0, rv); 54 54 55 rc = startmenu_open("/tmp/test", &smenu);55 rc = tbarcfg_open("/tmp/test", &tbcfg); 56 56 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 57 57 58 startmenu_close(smenu);58 tbarcfg_close(tbcfg); 59 59 } 60 60 … … 63 63 { 64 64 errno_t rc; 65 startmenu_t *smenu;66 s tartmenu_entry_t *e;65 tbarcfg_t *tbcfg; 66 smenu_entry_t *e; 67 67 FILE *f; 68 68 int rv; … … 80 80 PCUT_ASSERT_INT_EQUALS(0, rv); 81 81 82 rc = startmenu_open("/tmp/test", &smenu);82 rc = tbarcfg_open("/tmp/test", &tbcfg); 83 83 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 84 84 85 e = startmenu_first(smenu);85 e = tbarcfg_smenu_first(tbcfg); 86 86 PCUT_ASSERT_NOT_NULL(e); 87 e = startmenu_next(e);87 e = tbarcfg_smenu_next(e); 88 88 PCUT_ASSERT_NOT_NULL(e); 89 e = startmenu_next(e);89 e = tbarcfg_smenu_next(e); 90 90 PCUT_ASSERT_NULL(e); 91 91 92 startmenu_close(smenu);92 tbarcfg_close(tbcfg); 93 93 } 94 94 … … 97 97 { 98 98 errno_t rc; 99 startmenu_t *smenu;100 s tartmenu_entry_t *e;99 tbarcfg_t *tbcfg; 100 smenu_entry_t *e; 101 101 const char *caption; 102 102 const char *cmd; … … 115 115 PCUT_ASSERT_INT_EQUALS(0, rv); 116 116 117 rc = startmenu_open("/tmp/test", &smenu);117 rc = tbarcfg_open("/tmp/test", &tbcfg); 118 118 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 119 119 120 e = startmenu_first(smenu);120 e = tbarcfg_smenu_first(tbcfg); 121 121 PCUT_ASSERT_NOT_NULL(e); 122 122 123 caption = s tartmenu_entry_get_caption(e);123 caption = smenu_entry_get_caption(e); 124 124 PCUT_ASSERT_STR_EQUALS("A", caption); 125 cmd = s tartmenu_entry_get_cmd(e);125 cmd = smenu_entry_get_cmd(e); 126 126 PCUT_ASSERT_STR_EQUALS("a", cmd); 127 127 128 startmenu_close(smenu);128 tbarcfg_close(tbcfg); 129 129 } 130 130 131 PCUT_EXPORT( startmenu);131 PCUT_EXPORT(tbarcfg); -
uspace/lib/ui/src/wdecor.c
r4030072 rb279899 1112 1112 ui_wdecor_get_geom(wdecor, &geom); 1113 1113 1114 if ((wdecor->style & ui_wds_titlebar 1114 if ((wdecor->style & ui_wds_titlebar) != 0 && 1115 1115 (wdecor->style & ui_wds_sysmenu_hdl) != 0) { 1116 1116 if (event->type == POS_PRESS &&
Note:
See TracChangeset
for help on using the changeset viewer.