From fbb22531450502cfca68c8f104700986303f4e29 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 12 Apr 2020 09:14:17 +0000 Subject: [PATCH] fix for a f*cking mem git-svn-id: svn://kolibrios.org@7779 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/lib/gui/menu.h | 8 +++++--- programs/cmm/menu/menu.c | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/programs/cmm/lib/gui/menu.h b/programs/cmm/lib/gui/menu.h index 09be90fa42..5f74100912 100644 --- a/programs/cmm/lib/gui/menu.h +++ b/programs/cmm/lib/gui/menu.h @@ -97,9 +97,11 @@ :dword get_menu_click() { - dword res = ESDWORD[shared_mem]; - ESDWORD[shared_mem] = 0; - return res; + //dword res = ESDWORD[shared_mem]; + char res[2]; + ReadFile(0, 2, #res, "/tmp0/1/menu.tmp"); + //ESDWORD[shared_mem] = 0; + return res[0]; } #endif \ No newline at end of file diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index 80acfd4a8c..6e7f824f7e 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -35,9 +35,9 @@ int GetNextParam() void GetWindowPosition() { int position, rez; - shared_mem = memopen(#shared_name, 20, SHM_WRITE); - win_x = ESDWORD[shared_mem + 4]; - win_y = ESDWORD[shared_mem + 8]; + shared_mem = memopen(#shared_name, 20, SHM_READ); + win_x = ESDWORD[shared_mem + 4]; + win_y = ESDWORD[shared_mem + 8]; position = ESDWORD[shared_mem + 12]; selected = ESDWORD[shared_mem + 16]; if (position==2) win_x -= menu1.w; @@ -75,17 +75,12 @@ void main() { proc_info Form; - if (!param) - die( -"'This is a menu component used in Eolite, WebView, etc... -Please forget it if you are not a developer ;)' -I"); + if (!param) die("'Menu component is for developers only' -I"); GetMenuItems(#param); max_name_len = strlen(names.get(0)) * 6; max_hotkey_len = strlen(hotkeys.get(0)) * 6; - //selected = ESDWORD[shared_mem]; - menu1.count = names.count; menu1.SetFont(6, 9, 0x80); menu1.SetSizes(2,2, max_name_len + max_hotkey_len + 23, menu1.count*ITEM_H, ITEM_H); @@ -174,12 +169,17 @@ void draw_list() void click() { - ESDWORD[shared_mem] = menu1.cur_y + 1; + char res[2]; + res[0] = menu1.cur_y + 1; + res[1] = '\0'; + //ESDWORD[shared_mem] = menu1.cur_y + 1; + CreateFile(2, #res, "/tmp0/1/menu.tmp"); ExitProcess(); } void exit() { - ESDWORD[shared_mem] = 0; + //ESDWORD[shared_mem] = 0; + CreateFile(2, 0, "/tmp0/1/menu.tmp"); ExitProcess(); }