5 Commits

Author SHA1 Message Date
deepend-tildeclub
6f6d378600 Merge pull request #237 from ZoiteChat/ddh-null-gdkwindow
Guard GTK drag/drop handlers against null GdkWindow
2026-05-19 15:55:21 -06:00
deepend-tildeclub
216b463b8f Merge pull request #236 from ZoiteChat/native-dialog-box
Make native file chooser modal on Windows
2026-05-19 15:55:01 -06:00
4ad84cb5e5 Guard GTK drag/drop handlers against null GdkWindow 2026-05-19 15:46:06 -06:00
19e0946717 Make native file chooser modal on Windows 2026-05-19 15:11:55 -06:00
0de1ad06cd Null-safe /set string preference rendering 2026-05-19 15:07:21 -06:00
3 changed files with 23 additions and 3 deletions

View File

@@ -1168,8 +1168,11 @@ set_showval (session *sess, const struct prefs *var, char *tbuf)
switch (var->type)
{
case TYPE_STR:
sprintf (tbuf + len, "\0033:\017 %s\n", (char *) &prefs + var->offset);
break;
{
const char *value = (char *) &prefs + var->offset;
sprintf (tbuf + len, "\0033:\017 %s\n", value ? value : "");
}
break;
case TYPE_INT:
sprintf (tbuf + len, "\0033:\017 %d\n", *((int *) &prefs + var->offset));
break;

View File

@@ -522,6 +522,10 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
g_signal_connect (native, "response",
G_CALLBACK (gtkutil_native_file_req_response), freq);
if (flags & FRF_MODAL)
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (native), TRUE);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
return;
}

View File

@@ -5241,9 +5241,14 @@ static void
mg_handle_drop (GtkWidget *widget, int y, int *pos, int *other_pos)
{
int height;
GdkWindow *window;
session_gui *gui = current_sess->gui;
height = gdk_window_get_height (gtk_widget_get_window (widget));
window = gtk_widget_get_window (widget);
if (!window)
return;
height = gdk_window_get_height (window);
if (y < height / 2)
{
@@ -5321,6 +5326,9 @@ mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata)
return FALSE;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
@@ -5398,11 +5406,16 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
width = allocation.width;
height = allocation.height;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
}
else
{
ox = oy = 0;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
}