Message boxes now correctly use the translated title.

[GB.GTK]
* BUG: Message boxes now correctly use the translated title.

[GB.GTK3]
* BUG: Message boxes now correctly use the translated title.
* BUG: Rudimentary support for GDK backends that are not X11.
This commit is contained in:
gambas 2019-05-23 19:13:46 +02:00
parent 609e3348dd
commit 0bfe40ac76
6 changed files with 40 additions and 37 deletions

View file

@ -41,7 +41,6 @@ static void show_message_box(int type, MSG_PARAM *_p)
char *msg = GB.ToZeroString(ARG(msg));
char *btn1, *btn2, *btn3;
int ret;
char *title;
btn1 = MISSING(btn1) ? NULL : GB.ToZeroString(ARG(btn1));
btn2 = (type == 0 || MISSING(btn2)) ? NULL : GB.ToZeroString(ARG(btn2));
@ -55,10 +54,6 @@ static void show_message_box(int type, MSG_PARAM *_p)
_global_lock++;
title = gMessage::title();
if (!title)
title = GB.Application.Title();
switch (type)
{
case 0: ret = gMessage::showInfo(msg, btn1); break;

View file

@ -226,23 +226,19 @@ void gPlugin::plug(int id)
void gPlugin::discard()
{
#ifdef GAMBAS_DIRECTFB
stub("DIRECTFB/gPlugin:discard()");
#else
#ifdef GDK_WINDOWING_X11
if (MAIN_display_x11)
{
Display *d = gdk_x11_display_get_xdisplay(gdk_display_get_default());
Display *d = gdk_x11_display_get_xdisplay(gdk_display_get_default());
if (!client()) return;
XRemoveFromSaveSet(d, client());
XReparentWindow(d, client(), GDK_ROOT_WINDOW(), 0, 0);
if (!client()) return;
XRemoveFromSaveSet(d, client());
XReparentWindow(d, client(), GDK_ROOT_WINDOW(), 0, 0);
}
#else
stub("no-X11/gPlugin:discard()");
#endif
#endif
}
@ -1005,21 +1001,18 @@ gMainWindow* gControl::topLevel()
int gControl::handle()
{
#ifndef GAMBAS_DIRECTFB
#ifdef GDK_WINDOWING_X11
if (!gtk_widget_get_window(border))
return 0;
if (MAIN_display_x11)
{
GdkWindow *window = gtk_widget_get_window(border);
return window ? GDK_WINDOW_XID(window) : 0;
}
else
return GDK_WINDOW_XID(gtk_widget_get_window(border));
return 0;
#else
stub("no-X11/gControl::handle()");
return 0;
#endif
#else
stub("DIRECTFB/gControl::handle()");
return 0;
#endif
}
/*****************************************************************

View file

@ -237,7 +237,7 @@ bool gKey::mustIgnoreEvent(GdkEventKey *event)
if (!_im_has_input_method)
return false;
else
return (event->type == GDK_KEY_PRESS) && ((uchar)*event->string >= 32 || event->keyval == 0);
return (event->type == GDK_KEY_PRESS) && (event->keyval == 0 || !event->string || (uchar)*event->string >= 32);
}
void gcb_im_commit(GtkIMContext *context, const char *str, gpointer pointer)

View file

@ -112,6 +112,8 @@ guint custom_dialog(const gchar *icon,GtkButtonsType btn,char *sg)
if (bt.bt3) { gMnemonic_correctText(bt.bt3, &buf); bt.bt3 = buf; }
title = gMessage::title();
if (!title)
title = GB.Application.Title();
#ifdef GTK3
msg = gtk_dialog_new_with_buttons(title, NULL,

View file

@ -100,6 +100,7 @@ static GB_FUNCTION _application_keypress_func;
static void *_old_hook_main;
bool MAIN_display_x11 = FALSE;
int MAIN_scale = 0;
bool MAIN_debug_busy = false;
bool MAIN_rtl = false;
@ -257,17 +258,21 @@ void EXPORT GB_EXIT()
int EXPORT GB_INFO(const char *key, void **value)
{
if (!strcasecmp(key, "DISPLAY"))
if (MAIN_display_x11)
{
*value = (void *)gdk_x11_display_get_xdisplay(gdk_display_get_default());
return TRUE;
if (!strcasecmp(key, "DISPLAY"))
{
*value = (void *)gdk_x11_display_get_xdisplay(gdk_display_get_default());
return TRUE;
}
else if (!strcasecmp(key, "ROOT_WINDOW"))
{
*value = (void *)gdk_x11_get_default_root_xwindow();
return TRUE;
}
}
else if (!strcasecmp(key, "ROOT_WINDOW"))
{
*value = (void *)gdk_x11_get_default_root_xwindow();
return TRUE;
}
else if (!strcasecmp(key, "GET_HANDLE"))
if (!strcasecmp(key, "GET_HANDLE"))
{
*value = (void *)CWIDGET_get_handle;
return TRUE;
@ -355,7 +360,8 @@ void my_quit (void)
gApplication::exit();
#ifdef GDK_WINDOWING_X11
X11_exit();
if (MAIN_display_x11)
X11_exit();
#endif
}
@ -386,7 +392,13 @@ static void my_main(int *argc, char ***argv)
MAIN_scale = gDesktop::scale();
#ifdef GDK_WINDOWING_X11
X11_init(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gdk_x11_get_default_root_xwindow());
#ifdef GTK3
if (GDK_IS_X11_DISPLAY(gdk_display_get_default()))
#endif
{
X11_init(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gdk_x11_get_default_root_xwindow());
MAIN_display_x11 = TRUE;
}
#endif
if (GB.GetFunction(&_application_keypress_func, (void *)GB.Application.StartupClass(), "Application_KeyPress", "", "") == 0)

View file

@ -48,6 +48,7 @@ extern GB_CLASS CLASS_SvgImage;
extern bool MAIN_debug_busy;
extern bool MAIN_rtl;
extern bool MAIN_display_x11;
#endif
#define GB (*GB_PTR)