1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
Description: Fix illegal memory access by ui_window_set_icon().
* ui_window.[ch]:
- Fix illegal memory access by ui_window_set_icon().
(u_int32_t -> u_long)
(enbugged at 3d38b723e0e4a6dd434af2d49aca53890982a828)
- Execute initialization code for a root window in ui_window_show()
even if --parent option is specified.
(Related to https://github.com/arakiken/mlterm/issues/118)
- Add HINT_CHILD_WINDOW_ATTR for libvte compatible libraray.
Date: Fri Jan 3 02:01:40 2025 +0900
Origin: upstream, commit: 4eb3aa4bba9d918b1923b5a46a67c92142ecaade
Bug-Debian: https://bugs.debian.org/1089753
Index: mlterm/gtk/vte_xlib.c
===================================================================
--- mlterm.orig/gtk/vte_xlib.c 2025-01-06 15:56:15.723221871 +0100
+++ mlterm/gtk/vte_xlib.c 2025-01-06 15:56:15.719221924 +0100
@@ -499,7 +499,8 @@
}
#endif
- ui_display_show_root(disp, &PVT(terminal)->screen->window, 0, 0, 0, "mlterm", NULL, xid);
+ ui_display_show_root(disp, &PVT(terminal)->screen->window, 0, 0,
+ HINT_CHILD_WINDOW_ATTR, "mlterm", NULL, xid);
#if GTK_CHECK_VERSION(2, 90, 0) && defined(GDK_TYPE_X11_DEVICE_MANAGER_XI2)
if (is_xinput2) {
Index: mlterm/uitoolkit/ui_window.h
===================================================================
--- mlterm.orig/uitoolkit/ui_window.h 2025-01-06 15:56:15.723221871 +0100
+++ mlterm/uitoolkit/ui_window.h 2025-01-06 15:56:15.719221924 +0100
@@ -25,6 +25,13 @@
*/
#define PARENT_WINDOWID_IS_TOP(win) ((win)->parent_window == (win)->disp->my_window)
+/*
+ * Hint for libvte (x11), in addition to bitmask hints (0x0-0x20) returned by
+ * XParseGeometry().
+ * (see ui_window_show(), Xutil.h)
+ */
+#define HINT_CHILD_WINDOW_ATTR 0x1000
+
typedef enum ui_resize_flag {
NOTIFY_TO_NONE = 0x0,
NOTIFY_TO_CHILDREN = 0x01,
Index: mlterm/uitoolkit/xlib/ui_window.c
===================================================================
--- mlterm.orig/uitoolkit/xlib/ui_window.c 2025-01-06 15:56:15.723221871 +0100
+++ mlterm/uitoolkit/xlib/ui_window.c 2025-01-06 15:56:15.719221924 +0100
@@ -76,11 +76,11 @@
((win)->height_inc ? ((win)->height - (win)->min_height) % (win)->height_inc : 0)
typedef struct {
- u_int32_t flags;
- u_int32_t functions;
- u_int32_t decorations;
- int32_t inputMode;
- u_int32_t status;
+ u_long flags;
+ u_long functions;
+ u_long decorations;
+ u_long inputMode;
+ u_long status;
} MWMHints_t;
#define MWM_HINTS_ELEMENTS 5
@@ -1344,29 +1344,8 @@
ACTUAL_HEIGHT(win), 0, win->fg_color.pixel, win->bg_color.pixel);
#endif
- if (win->create_gc) {
- ui_gc_t *gc;
-
- if ((gc = ui_gc_new(win->disp->display, win->my_window)) == NULL) {
-#ifdef DEBUG
- bl_debug_printf(BL_DEBUG_TAG " ui_gc_new failed.\n");
-#endif
- win->create_gc = 0;
- } else {
- win->gc = gc;
- }
- }
-
- if (win->cursor_shape) {
- Cursor cursor;
-
- if ((cursor = ui_display_get_cursor(win->disp, win->cursor_shape))) {
- XDefineCursor(win->disp->display, win->my_window, cursor);
- }
- }
-
/* Don't use win->parent here in case mlterm works as libvte. */
- if (PARENT_WINDOWID_IS_TOP(win)) {
+ if (PARENT_WINDOWID_IS_TOP(win) || !(hint & HINT_CHILD_WINDOW_ATTR)) {
/* Root window */
XSizeHints size_hints;
@@ -1378,9 +1357,11 @@
"mlterm", NULL,
};
Atom protocols[2];
- XID pid;
+ u_long pid;
win->event_mask |= StructureNotifyMask;
+ /* Call XSelectInput just after creating a new Window not to miss any events. */
+ XSelectInput(win->disp->display, win->my_window, win->event_mask);
/*
* XXX
@@ -1466,6 +1447,30 @@
8, PropModeReplace, (unsigned char *)win->wm_role,
(int)strlen(win->wm_role));
}
+ } else {
+ /* Call XSelectInput just after creating a new Window not to miss any events. */
+ XSelectInput(win->disp->display, win->my_window, win->event_mask);
+ }
+
+ if (win->create_gc) {
+ ui_gc_t *gc;
+
+ if ((gc = ui_gc_new(win->disp->display, win->my_window)) == NULL) {
+#ifdef DEBUG
+ bl_debug_printf(BL_DEBUG_TAG " ui_gc_new failed.\n");
+#endif
+ win->create_gc = 0;
+ } else {
+ win->gc = gc;
+ }
+ }
+
+ if (win->cursor_shape) {
+ Cursor cursor;
+
+ if ((cursor = ui_display_get_cursor(win->disp, win->cursor_shape))) {
+ XDefineCursor(win->disp->display, win->my_window, cursor);
+ }
}
if (win->parent && !win->parent->is_transparent && win->parent->wall_picture_is_set) {
@@ -1480,8 +1485,6 @@
(*win->window_realized)(win);
}
- XSelectInput(win->disp->display, win->my_window, win->event_mask);
-
#if 0
{
char *locale;
@@ -3179,7 +3182,7 @@
/* set extended window manager hint's icon */
if (icon->cardinal && icon->cardinal[0] && icon->cardinal[1]) {
int num;
- u_int32_t *data;
+ u_long *data;
/* width * height + 2 */
num = icon->cardinal[0] * icon->cardinal[1] + 2;
@@ -3187,7 +3190,7 @@
if (sizeof(u_long) != 4) {
int count;
- if (!(data = alloca(sizeof(u_int32_t) * num))) {
+ if (!(data = alloca(sizeof(u_long) * num))) {
return;
}
@@ -3195,7 +3198,7 @@
data[count] = icon->cardinal[count];
}
} else {
- data = icon->cardinal;
+ data = (u_long*)icon->cardinal;
}
/*it should be possible to set multiple icons...*/
|