Sun, 05 Jan 2025 10:10:47 +0100
implement progress spinner (Motif)
0 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
4 | * Copyright 2024 Olaf Wintermann. All rights reserved. |
0 | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #include <stdio.h> | |
30 | #include <stdlib.h> | |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
31 | #include <unistd.h> |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
32 | #include <pthread.h> |
0 | 33 | |
34 | #include "toolkit.h" | |
3 | 35 | #include "toolbar.h" |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
36 | #include "container.h" |
3 | 37 | #include "stock.h" |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
38 | #include "../common/menu.h" |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
39 | #include "../common/toolbar.h" |
1
eb5269000bc8
added some document functions
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
40 | #include "../common/document.h" |
24
06bceda81a03
added application properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
41 | #include "../common/properties.h" |
176
bc63cb601f6d
port motif code to ucx 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
160
diff
changeset
|
42 | #include <cx/buffer.h> |
0 | 43 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
44 | #include <X11/Intrinsic.h> |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
45 | #include <Xm/CutPaste.h> |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
46 | |
0 | 47 | static XtAppContext app; |
48 | static Display *display; | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
49 | static Widget active_window; |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
50 | static const char *application_name; |
0 | 51 | |
134
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
52 | static ui_callback startup_func; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
53 | static void *startup_data; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
54 | static ui_callback open_func; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
55 | void *open_data; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
56 | static ui_callback exit_func; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
57 | void *exit_data; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
58 | |
0 | 59 | static ui_callback appclose_fnc; |
60 | static void *appclose_udata; | |
61 | ||
62 | static int is_toplevel_realized = 0; | |
63 | ||
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
64 | int event_pipe[2]; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
65 | |
160
b3f36bfe1b41
Motif: enable xft text rendering by default
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
157
diff
changeset
|
66 | |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
67 | static String fallback[] = { |
433
605bb5dc34f1
implement progress spinner (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
427
diff
changeset
|
68 | //"*fontList: -dt-interface system-medium-r-normal-s*utf*:", |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
69 | "*renderTable: rt", |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
70 | "*rt*fontType: FONT_IS_XFT", |
160
b3f36bfe1b41
Motif: enable xft text rendering by default
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
157
diff
changeset
|
71 | "*rt*fontName: Sans", |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
72 | "*rt*fontSize: 11", |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
73 | |
433
605bb5dc34f1
implement progress spinner (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
427
diff
changeset
|
74 | "*progresss_spinner*renderTable*fontType: FONT_IS_FONT", |
605bb5dc34f1
implement progress spinner (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
427
diff
changeset
|
75 | "*progresss_spinner*renderTable*fontName: Cursor", |
605bb5dc34f1
implement progress spinner (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
427
diff
changeset
|
76 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
77 | "*window_frame.shadowType: SHADOW_ETCHED_OUT", |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
78 | "*window_frame.shadowThickness: 1", |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
79 | "*togglebutton.shadowThickness: 1", |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
80 | "*togglebutton.highlightThickness: 2", |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
81 | NULL |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
82 | }; |
0 | 83 | |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
84 | void input_proc(XtPointer data, int *source, XtInputId *iid) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
85 | void *ptr; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
86 | read(event_pipe[0], &ptr, sizeof(void*)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
87 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
88 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
89 | void ui_init(const char *appname, int argc, char **argv) { |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
90 | application_name = appname; |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
91 | uic_init_global_context(); |
0 | 92 | |
93 | XtToolkitInitialize(); | |
94 | XtSetLanguageProc(NULL, NULL, NULL); | |
95 | app = XtCreateApplicationContext(); | |
46
4a5e0b9b6992
fixed fonts (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
96 | XtAppSetFallbackResources(app, fallback); |
0 | 97 | |
98 | display = XtOpenDisplay(app, NULL, appname, appname, NULL, 0, &argc, argv); | |
99 | ||
100 | uic_docmgr_init(); | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
101 | uic_menu_init(); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
102 | uic_toolbar_init(); |
24
06bceda81a03
added application properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
103 | uic_load_app_properties(); |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
104 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
105 | if(pipe(event_pipe)) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
106 | fprintf(stderr, "UiError: Cannot create event pipe\n"); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
107 | exit(-1); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
108 | } |
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
109 | XtAppAddInput( |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
110 | app, |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
111 | event_pipe[0], |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
112 | (XtPointer)XtInputReadMask, |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
113 | input_proc, |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
114 | NULL); |
0 | 115 | } |
116 | ||
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
117 | const char* ui_appname() { |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
118 | return application_name; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
119 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
120 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
121 | Display* ui_motif_get_display() { |
0 | 122 | return display; |
123 | } | |
124 | ||
134
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
125 | void ui_onstartup(ui_callback f, void *userdata) { |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
126 | startup_func = f; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
127 | startup_data = userdata; |
0 | 128 | } |
129 | ||
134
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
130 | void ui_onopen(ui_callback f, void *userdata) { |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
131 | open_func = f; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
132 | open_data = userdata; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
133 | } |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
134 | |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
135 | void ui_onexit(ui_callback f, void *userdata) { |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
136 | exit_func = f; |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
137 | exit_data = userdata; |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
138 | } |
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
139 | |
0 | 140 | void ui_main() { |
134
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
141 | if(startup_func) { |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
142 | startup_func(NULL, startup_data); |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
143 | } |
0 | 144 | XtAppMainLoop(app); |
134
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
145 | if(exit_func) { |
69e8e0936858
adds new app callbacks (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
122
diff
changeset
|
146 | exit_func(NULL, exit_data); |
0 | 147 | } |
24
06bceda81a03
added application properties
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
21
diff
changeset
|
148 | uic_store_app_properties(); |
0 | 149 | } |
150 | ||
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
151 | void ui_exit_mainloop() { |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
152 | XtAppSetExitFlag(app); |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
153 | } |
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
154 | |
28
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
155 | void ui_secondary_event_loop(int *loop) { |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
156 | while(*loop && !XtAppGetExitFlag(app)) { |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
157 | XEvent event; |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
158 | XtAppNextEvent(app, &event); |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
159 | XtDispatchEvent(&event); |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
160 | } |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
161 | } |
794a5c91c479
added open/save dialogs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
27
diff
changeset
|
162 | |
0 | 163 | void ui_show(UiObject *obj) { |
21
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
164 | uic_check_group_widgets(obj->ctx); |
0 | 165 | XtRealizeWidget(obj->widget); |
166 | } | |
21
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
167 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
168 | void ui_close(UiObject *obj) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
169 | |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
170 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
171 | |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
172 | |
21
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
173 | void ui_set_enabled(UIWIDGET widget, int enabled) { |
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
174 | XtSetSensitive(widget, enabled); |
012418e7dc90
added groups for menu items (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
3
diff
changeset
|
175 | } |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
176 | |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
177 | void ui_set_show_all(UIWIDGET widget, int value) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
178 | if(!value) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
179 | XtUnmanageChild(widget); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
180 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
181 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
182 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
183 | void ui_set_visible(UIWIDGET widget, int visible) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
184 | if(visible) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
185 | XtManageChild(widget); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
186 | } else { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
187 | XtUnmanageChild(widget); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
188 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
189 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
190 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
191 | static Boolean ui_job_finished(void *data) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
192 | UiJob *job = data; |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
193 | if(job->finish_callback) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
194 | UiEvent event; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
195 | event.obj = job->obj; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
196 | event.window = job->obj->window; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
197 | event.document = job->obj->ctx->document; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
198 | event.intval = 0; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
199 | event.eventdata = NULL; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
200 | job->finish_callback(&event, job->finish_data); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
201 | } |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
202 | free(job); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
203 | return TRUE; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
204 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
205 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
206 | static void* ui_jobthread(void *data) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
207 | UiJob *job = data; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
208 | int result = job->job_func(job->job_data); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
209 | if(!result) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
210 | write(event_pipe[1], &job, sizeof(void*)); // hack |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
211 | XtAppAddWorkProc(app, ui_job_finished, job); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
212 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
213 | } |
176
bc63cb601f6d
port motif code to ucx 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
160
diff
changeset
|
214 | return NULL; |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
215 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
216 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
217 | void ui_job(UiObject *obj, ui_threadfunc tf, void *td, ui_callback f, void *fd) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
218 | UiJob *job = malloc(sizeof(UiJob)); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
219 | job->obj = obj; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
220 | job->job_func = tf; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
221 | job->job_data = td; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
222 | job->finish_callback = f; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
223 | job->finish_data = fd; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
224 | pthread_t pid; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
225 | pthread_create(&pid, NULL, ui_jobthread, job); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
226 | } |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
30
diff
changeset
|
227 | |
27
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
228 | void ui_clipboard_set(char *str) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
229 | int length = strlen(str) + 1; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
230 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
231 | Display *dp = XtDisplayOfObject(active_window); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
232 | Window window = XtWindowOfObject(active_window); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
233 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
234 | XmString label = XmStringCreateLocalized("toolkit_clipboard"); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
235 | long id = 0; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
236 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
237 | while(XmClipboardStartCopy( |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
238 | dp, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
239 | window, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
240 | label, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
241 | CurrentTime, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
242 | NULL, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
243 | NULL, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
244 | &id) == ClipboardLocked); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
245 | XmStringFree(label); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
246 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
247 | while(XmClipboardCopy( |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
248 | dp, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
249 | window, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
250 | id, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
251 | "STRING", |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
252 | str, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
253 | length, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
254 | 1, |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
255 | NULL) == ClipboardLocked); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
256 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
257 | while(XmClipboardEndCopy(dp, window, id) == ClipboardLocked); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
258 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
259 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
260 | char* ui_clipboard_get() { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
261 | Display *dp = XtDisplayOfObject(active_window); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
262 | Window window = XtWindowOfObject(active_window); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
263 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
264 | long id; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
265 | size_t size = 128; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
266 | char *buf = malloc(size); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
267 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
268 | int r; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
269 | for(;;) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
270 | r = XmClipboardRetrieve(dp, window, "STRING", buf, size, NULL, &id); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
271 | if(r == ClipboardSuccess) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
272 | break; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
273 | } else if(r == ClipboardTruncate) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
274 | size *= 2; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
275 | buf = realloc(buf, size); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
276 | } else if(r == ClipboardNoData) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
277 | free(buf); |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
278 | buf = NULL; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
279 | break; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
280 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
281 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
282 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
283 | return buf; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
284 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
285 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
286 | void ui_set_active_window(Widget w) { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
287 | active_window = w; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
288 | } |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
289 | |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
290 | Widget ui_get_active_window() { |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
291 | return active_window; |
77b09bb52ca0
added groups for toolbar items and copy & paste (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
292 | } |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
293 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
294 | /* |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
295 | * doesn't work with gnome anymore |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
296 | */ |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
297 | void ui_window_dark_theme(Display *dp, Window window) { |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
298 | Atom atom = XInternAtom(dp, "_GTK_THEME_VARIANT", False); |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
299 | Atom type = XInternAtom(dp, "UTF8_STRING", False); |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
300 | XChangeProperty( |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
301 | dp, |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
302 | window, |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
303 | atom, |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
304 | type, |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
305 | 8, |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
306 | PropModeReplace, |
122
e82b01d17a78
added some special textfields (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
307 | (const unsigned char*)"dark", |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
308 | 4); |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
309 | } |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
310 | |
427
7ead63398a50
implement listview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
311 | void ui_destroy_eventdata(Widget w, XtPointer data, XtPointer d) { |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
312 | free(data); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
313 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
314 | |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
315 | void ui_set_widget_groups(UiContext *ctx, Widget widget, const int *groups) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
316 | if(!groups) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
317 | return; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
318 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
319 | size_t ngroups = uic_group_array_size(groups); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
320 | ui_set_widget_ngroups(ctx, widget, groups, ngroups); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
321 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
322 | |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
323 | void ui_set_widget_ngroups(UiContext *ctx, Widget widget, const int *groups, size_t ngroups) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
324 | if(ngroups > 0) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
325 | uic_add_group_widget_i(ctx, widget, (ui_enablefunc)ui_set_enabled, groups, ngroups); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
326 | ui_set_enabled(widget, FALSE); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
327 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
328 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
176
diff
changeset
|
329 |