# HG changeset patch # User Olaf Wintermann # Date 1730282872 -3600 # Node ID 2eede3d98aba07d135c2fe693c68254fc2c2f650 # Parent 4657ec1229f2555d5e641894ecfd9c8d33039959 implement windows condvar diff -r 4657ec1229f2 -r 2eede3d98aba make/vs/testapp/packages.config --- a/make/vs/testapp/packages.config Wed Oct 30 10:14:47 2024 +0100 +++ b/make/vs/testapp/packages.config Wed Oct 30 11:07:52 2024 +0100 @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff -r 4657ec1229f2 -r 2eede3d98aba make/vs/testapp/testapp.vcxproj --- a/make/vs/testapp/testapp.vcxproj Wed Oct 30 10:14:47 2024 +0100 +++ b/make/vs/testapp/testapp.vcxproj Wed Oct 30 11:07:52 2024 +0100 @@ -1,8 +1,8 @@ - - - + + + Debug @@ -157,21 +157,21 @@ - - - - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + + + + + + + \ No newline at end of file diff -r 4657ec1229f2 -r 2eede3d98aba make/vs/ucx/ucx.vcxproj --- a/make/vs/ucx/ucx.vcxproj Wed Oct 30 10:14:47 2024 +0100 +++ b/make/vs/ucx/ucx.vcxproj Wed Oct 30 11:07:52 2024 +0100 @@ -138,12 +138,15 @@ + + + @@ -162,6 +165,8 @@ + + diff -r 4657ec1229f2 -r 2eede3d98aba make/vs/ucx/ucx.vcxproj.filters --- a/make/vs/ucx/ucx.vcxproj.filters Wed Oct 30 10:14:47 2024 +0100 +++ b/make/vs/ucx/ucx.vcxproj.filters Wed Oct 30 11:07:52 2024 +0100 @@ -54,6 +54,15 @@ Quelldateien + + Quelldateien + + + Quelldateien + + + Quelldateien + @@ -104,5 +113,11 @@ Headerdateien + + Headerdateien + + + Headerdateien + \ No newline at end of file diff -r 4657ec1229f2 -r 2eede3d98aba ucx/cx/map.h --- a/ucx/cx/map.h Wed Oct 30 10:14:47 2024 +0100 +++ b/ucx/cx/map.h Wed Oct 30 11:07:52 2024 +0100 @@ -657,7 +657,7 @@ CxMap *map, CxHashKey key ) { - return map->cl->remove(map, key, !map->store_pointer); + return map->cl->remove(map, key, !map->collection.store_pointer); } /** @@ -684,7 +684,7 @@ CxMap *map, cxstring key ) { - return map->cl->remove(map, cx_hash_key_cxstr(key), !map->store_pointer); + return map->cl->remove(map, cx_hash_key_cxstr(key), !map->collection.store_pointer); } /** @@ -711,7 +711,7 @@ CxMap *map, cxmutstr key ) { - return map->cl->remove(map, cx_hash_key_cxstr(key), !map->store_pointer); + return map->cl->remove(map, cx_hash_key_cxstr(key), !map->collection.store_pointer); } /** @@ -738,7 +738,7 @@ CxMap *map, const char *key ) { - return map->cl->remove(map, cx_hash_key_str(key), !map->store_pointer); + return map->cl->remove(map, cx_hash_key_str(key), !map->collection.store_pointer); } #else // __cplusplus diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/button.cpp --- a/ui/winui/button.cpp Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/button.cpp Wed Oct 30 11:07:52 2024 +0100 @@ -287,7 +287,7 @@ // get or create the group name static int groupCount = 0; winrt::hstring groupName; - if (radioButtons->size == 0) { + if (cxListSize(radioButtons) == 0) { groupName = winrt::to_hstring(groupCount++); } else { UiWidget* firstButtonWidget = (UiWidget*)cxListAt(radioButtons, 0); diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/condvar.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/condvar.cpp Wed Oct 30 11:07:52 2024 +0100 @@ -0,0 +1,68 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2024 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "pch.h" +#include "condvar.h" + + + +UiCondVar* ui_condvar_create(void) { + UiWinCondVar *var = (UiWinCondVar*)malloc(sizeof(UiWinCondVar)); + var->var.data = NULL; + var->var.intdata = 0; + var->set = 0; + return (UiCondVar*)var; +} + +void ui_condvar_wait(UiCondVar *var) { + UiWinCondVar *p = (UiWinCondVar*)var; + p->mutex.lock(); + if(!p->set) { + std::unique_lock lock(p->mutex); + p->cond.wait(lock); + } + p->set = 0; + p->mutex.unlock(); + +} + +void ui_condvar_signal(UiCondVar *var, void *data, int intdata) { + UiWinCondVar *p = (UiWinCondVar*)var; + p->mutex.lock(); + p->var.data = data; + p->var.intdata = intdata; + p->set = 1; + p->cond.notify_one(); + p->mutex.unlock(); +} + +void ui_condvar_destroy(UiCondVar *var) { + UiWinCondVar *p = (UiWinCondVar*)var; + free(p); + +} diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/condvar.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui/winui/condvar.h Wed Oct 30 11:07:52 2024 +0100 @@ -0,0 +1,55 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2024 Olaf Wintermann. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef UI_WIN_CONDVAR_H +#define UI_WIN_CONDVAR_H + +#include "toolkit.h" + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct UiWinCondVar { + UiCondVar var; + int set; + std::mutex mutex; + std::condition_variable cond; +} UiWinCondVar; + + +#ifdef __cplusplus +} +#endif + +#endif /* UI_WIN_CONDVAR_H */ + diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/icons.cpp --- a/ui/winui/icons.cpp Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/icons.cpp Wed Oct 30 11:07:52 2024 +0100 @@ -29,6 +29,7 @@ #include "pch.h" #include "icons.h" +#include "../ui/icons.h" #include #include diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/packages.config --- a/ui/winui/packages.config Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/packages.config Wed Oct 30 11:07:52 2024 +0100 @@ -1,7 +1,7 @@  - - - - + + + + \ No newline at end of file diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/toolkit.cpp --- a/ui/winui/toolkit.cpp Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/toolkit.cpp Wed Oct 30 11:07:52 2024 +0100 @@ -235,17 +235,9 @@ } void ui_close(UiObject* obj) { - -} - -static void ui_job_finished(UiJob *job) { - UiEvent event; - event.obj = job->obj; - event.window = job->obj->window; - event.document = job->obj->ctx->document; - event.intval = 0; - event.eventdata = NULL; - job->finish_callback(&event, job->finish_data); + if (obj->wobj) { + obj->wobj->window.Close(); + } } static void ui_job_thread(UiJob* job) { diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/window.cpp --- a/ui/winui/window.cpp Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/window.cpp Wed Oct 30 11:07:52 2024 +0100 @@ -109,14 +109,14 @@ CxList* def_r = uic_get_toolbar_defaults(UI_TOOLBAR_RIGHT); bool addappmenu = true; - if (def_r->size > 0) { + if (cxListSize(def_r) > 0) { CommandBar toolbar_r = ui_create_toolbar(obj, def_r, addappmenu); toolbar_grid.SetColumn(toolbar_r, 2); toolbar_grid.SetRow(toolbar_r, 0); toolbar_grid.Children().Append(toolbar_r); addappmenu = false; } - if (def_c->size > 0) { + if (cxListSize(def_c) > 0) { CommandBar toolbar_c = ui_create_toolbar(obj, def_c, addappmenu); toolbar_c.HorizontalAlignment(HorizontalAlignment::Center); toolbar_grid.SetColumn(toolbar_c, 1); @@ -124,7 +124,7 @@ toolbar_grid.Children().Append(toolbar_c); addappmenu = false; } - if (def_l->size > 0) { + if (cxListSize(def_l) > 0) { CommandBar toolbar_l = ui_create_toolbar(obj, def_l, addappmenu); toolbar_grid.SetColumn(toolbar_l, 0); toolbar_grid.SetRow(toolbar_l, 0); diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/winui.vcxproj --- a/ui/winui/winui.vcxproj Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/winui.vcxproj Wed Oct 30 11:07:52 2024 +0100 @@ -1,8 +1,8 @@  - - - + + + true true @@ -133,6 +133,7 @@ + @@ -160,6 +161,7 @@ + @@ -239,21 +241,21 @@ - - - - + + + + Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - - - + + + + + + + \ No newline at end of file diff -r 4657ec1229f2 -r 2eede3d98aba ui/winui/winui.vcxproj.filters --- a/ui/winui/winui.vcxproj.filters Wed Oct 30 10:14:47 2024 +0100 +++ b/ui/winui/winui.vcxproj.filters Wed Oct 30 11:07:52 2024 +0100 @@ -27,6 +27,7 @@ + @@ -95,6 +96,7 @@ +