fix for a f*cking mem

git-svn-id: svn://kolibrios.org@7779 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-04-12 09:14:17 +00:00
parent 3ad0875d89
commit fbb2253145
2 changed files with 16 additions and 14 deletions

View File

@ -97,9 +97,11 @@
:dword get_menu_click() :dword get_menu_click()
{ {
dword res = ESDWORD[shared_mem]; //dword res = ESDWORD[shared_mem];
ESDWORD[shared_mem] = 0; char res[2];
return res; ReadFile(0, 2, #res, "/tmp0/1/menu.tmp");
//ESDWORD[shared_mem] = 0;
return res[0];
} }
#endif #endif

View File

@ -35,9 +35,9 @@ int GetNextParam()
void GetWindowPosition() void GetWindowPosition()
{ {
int position, rez; int position, rez;
shared_mem = memopen(#shared_name, 20, SHM_WRITE); shared_mem = memopen(#shared_name, 20, SHM_READ);
win_x = ESDWORD[shared_mem + 4]; win_x = ESDWORD[shared_mem + 4];
win_y = ESDWORD[shared_mem + 8]; win_y = ESDWORD[shared_mem + 8];
position = ESDWORD[shared_mem + 12]; position = ESDWORD[shared_mem + 12];
selected = ESDWORD[shared_mem + 16]; selected = ESDWORD[shared_mem + 16];
if (position==2) win_x -= menu1.w; if (position==2) win_x -= menu1.w;
@ -75,17 +75,12 @@ void main()
{ {
proc_info Form; proc_info Form;
if (!param) if (!param) die("'Menu component is for developers only' -I");
die(
"'This is a menu component used in Eolite, WebView, etc...
Please forget it if you are not a developer ;)' -I");
GetMenuItems(#param); GetMenuItems(#param);
max_name_len = strlen(names.get(0)) * 6; max_name_len = strlen(names.get(0)) * 6;
max_hotkey_len = strlen(hotkeys.get(0)) * 6; max_hotkey_len = strlen(hotkeys.get(0)) * 6;
//selected = ESDWORD[shared_mem];
menu1.count = names.count; menu1.count = names.count;
menu1.SetFont(6, 9, 0x80); menu1.SetFont(6, 9, 0x80);
menu1.SetSizes(2,2, max_name_len + max_hotkey_len + 23, menu1.count*ITEM_H, ITEM_H); 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() 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(); ExitProcess();
} }
void exit() void exit()
{ {
ESDWORD[shared_mem] = 0; //ESDWORD[shared_mem] = 0;
CreateFile(2, 0, "/tmp0/1/menu.tmp");
ExitProcess(); ExitProcess();
} }