From d5cbb62ef5339e7aeb648f7628f9895b3a14a7f9 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 16 Dec 2021 16:51:49 +0000 Subject: [PATCH] @reshare: upload a new app in C-- that allows to access some resources using shared memory. Now availabe: unpacked icons32.png, icons16.png, icons16.png with filled background by a working color. git-svn-id: svn://kolibrios.org@9426 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/misc/Tupfile.lua | 1 + programs/cmm/misc/reshare.c | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 programs/cmm/misc/reshare.c diff --git a/programs/cmm/misc/Tupfile.lua b/programs/cmm/misc/Tupfile.lua index bff7675e3f..b65b24563c 100644 --- a/programs/cmm/misc/Tupfile.lua +++ b/programs/cmm/misc/Tupfile.lua @@ -11,5 +11,6 @@ tup.rule("notify.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_ tup.rule("osupdate.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "osupdate.com") tup.rule("pipet.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pipet.com") tup.rule("software_widget.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "software_widget.com") +tup.rule("reshare.c", "c-- %f" .. tup.getconfig("KPACK_CMD"), "reshare.com") tup.rule("kfm2.c", "c-- %f" .. tup.getconfig("KPACK_CMD"), "kfm2.com") diff --git a/programs/cmm/misc/reshare.c b/programs/cmm/misc/reshare.c new file mode 100644 index 0000000000..f65071c8a1 --- /dev/null +++ b/programs/cmm/misc/reshare.c @@ -0,0 +1,50 @@ +#define MEMSIZE 1024*50 +#define ENTRY_POINT #main + +#include "../lib/fs.h" +#include "../lib/mem.h" +#include "../lib/obj/libimg.h" +#include "../lib/patterns/rgb.h" + +void main() +{ + libimg_image icons32; + libimg_image icons16; + libimg_image icons16w; + unsigned int size32; + unsigned int size16; + char* shared_i32; + char* shared_i16; + char* shared_i16w; + + mem_init(); + load_dll(libimg, #libimg_init, 1); + @SetEventMask(EVM_DESKTOPBG); + + icons32.load("/sys/icons32.png"); size32 = icons32.h * 32 * 4; + icons16.load("/sys/icons16.png"); size16 = icons16.h * 18 * 4; + + shared_i32 = memopen("ICONS32", size32, SHM_CREATE+SHM_WRITE); + debugval("@reshare shared_i32", shared_i32); + memmov(shared_i32, icons32.imgsrc, size32); + + shared_i16 = memopen("ICONS18", size16, SHM_CREATE + SHM_WRITE); + memmov(shared_i16, icons16.imgsrc, size16); + debugval("@reshare shared_i32", shared_i16); + + shared_i16w = memopen("ICONS18W", size16, SHM_CREATE + SHM_WRITE); + +UPDATE_ICONS18WORK: + $push sc.work + sc.get(); + $pop eax + IF (sc.work != EAX) { + icons16w.load("/sys/icons16.png"); + //icons16w.replace_color(0xffFFFfff, sc.work); + //icons16w.replace_color(0xffCACBD6, MixColors(sc.work, 0, 200)); + icons16w.replace_2colors(0xffFFFfff, sc.work, 0xffCACBD6, MixColors(sc.work, 0, 200)); + memmov(shared_i16w, icons16w.imgsrc, size16); + } + + loop() IF(WaitEvent()==evDesktop) GOTO UPDATE_ICONS18WORK; +}