[Linux] Port some bits from Alchemy & future to stop using dark-ages deprecated GDK/GTK.
Todo: Revisit this and clean up some code duplication I stumbled over in the process. (legacy.cpp llwindowsdl.cpp)
This commit is contained in:
@@ -136,6 +136,10 @@ if (LINUX)
|
||||
-DLL_LINUX=1
|
||||
-DAPPID=secondlife
|
||||
-D_REENTRANT
|
||||
-DGDK_DISABLE_DEPRECATED
|
||||
-DGTK_DISABLE_DEPRECATED
|
||||
-DGSEAL_ENABLE
|
||||
-DGTK_DISABLE_SINGLE_INCLUDES
|
||||
)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||
|
||||
@@ -45,12 +45,13 @@
|
||||
|
||||
#if LL_GTK
|
||||
extern "C" {
|
||||
# include <gtk/gtk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#if GTK_CHECK_VERSION(2, 24, 0)
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
}
|
||||
#include <locale.h>
|
||||
#include <clocale>
|
||||
#endif // LL_GTK
|
||||
|
||||
extern "C" {
|
||||
@@ -1543,7 +1544,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture)
|
||||
|
||||
XUngrabPointer(mSDL_Display, CurrentTime);
|
||||
// Make sure the ungrab happens RIGHT NOW.
|
||||
XSync(mSDL_Display, False);
|
||||
XSync(mSDL_Display, FALSE);
|
||||
} else
|
||||
{
|
||||
newmode = SDL_GRAB_QUERY; // neutral
|
||||
@@ -2269,8 +2270,12 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ
|
||||
gWindowImplementation->mSDL_XWindowID != None)
|
||||
{
|
||||
gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
|
||||
GdkWindow *gdkwin = gdk_window_foreign_new(gWindowImplementation->mSDL_XWindowID);
|
||||
gdk_window_set_transient_for(GTK_WIDGET(win)->window, gdkwin);
|
||||
#if GTK_CHECK_VERSION(2, 24, 0)
|
||||
GdkWindow* gdkwin = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), static_cast<Window>(gWindowImplementation->mSDL_XWindowID));
|
||||
#else
|
||||
GdkWindow* gdkwin = gdk_window_foreign_new(static_cast<GdkNativeWindow>(gWindowImplementation->mSDL_XWindowID));
|
||||
#endif
|
||||
gdk_window_set_transient_for(gtk_widget_get_window(GTK_WIDGET(win)), gdkwin);
|
||||
}
|
||||
# endif //LL_X11
|
||||
|
||||
@@ -2384,12 +2389,16 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||
if (mSDL_XWindowID != None)
|
||||
{
|
||||
gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
|
||||
GdkWindow *gdkwin = gdk_window_foreign_new(mSDL_XWindowID);
|
||||
gdk_window_set_transient_for(GTK_WIDGET(win)->window, gdkwin);
|
||||
#if GTK_CHECK_VERSION(2, 24, 0)
|
||||
GdkWindow* gdkwin = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), static_cast<Window>(mSDL_XWindowID));
|
||||
#else
|
||||
GdkWindow* gdkwin = gdk_window_foreign_new(static_cast<GdkNativeWindow>(mSDL_XWindowID));
|
||||
#endif
|
||||
gdk_window_set_transient_for(gtk_widget_get_window(GTK_WIDGET(win)), gdkwin);
|
||||
}
|
||||
# endif //LL_X11
|
||||
#endif //LL_X11
|
||||
|
||||
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG(win)->colorsel);
|
||||
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG(win)));
|
||||
|
||||
GdkColor color, orig_color;
|
||||
orig_color.pixel = 0;
|
||||
@@ -2415,8 +2424,6 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||
|
||||
gtk_window_set_modal(GTK_WINDOW(win), TRUE);
|
||||
gtk_widget_show_all(win);
|
||||
// hide the help button - we don't service it.
|
||||
gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(win)->help_button);
|
||||
gtk_main();
|
||||
|
||||
if (response == GTK_RESPONSE_OK &&
|
||||
@@ -2498,7 +2505,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
if (mSDL_Display)
|
||||
{
|
||||
// Just in case - before forking.
|
||||
XSync(mSDL_Display, False);
|
||||
XSync(mSDL_Display, FALSE);
|
||||
}
|
||||
# endif // LL_X11
|
||||
|
||||
@@ -2548,7 +2555,7 @@ void LLWindowSDL::bringToFront()
|
||||
if (mSDL_Display && !mFullscreen)
|
||||
{
|
||||
XRaiseWindow(mSDL_Display, mSDL_XWindowID);
|
||||
XSync(mSDL_Display, False);
|
||||
XSync(mSDL_Display, FALSE);
|
||||
}
|
||||
#endif // LL_X11
|
||||
}
|
||||
|
||||
@@ -35,6 +35,21 @@
|
||||
#include "llerror.h"
|
||||
#include "basic_plugin_base.h" // For PLS_INFOS etc.
|
||||
|
||||
#if LL_SDL
|
||||
|
||||
#if LL_GTK
|
||||
extern "C" {
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#if GTK_CHECK_VERSION(2, 24, 0)
|
||||
#include <gdk/gdkx.h>
|
||||
#endif
|
||||
}
|
||||
#include <clocale>
|
||||
#endif // LL_GTK
|
||||
|
||||
#endif // LL_SDL
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
@@ -1332,11 +1347,21 @@ GtkWindow* LLFilePickerBase::buildFilePicker(bool is_save, bool is_folder, std::
|
||||
// Make GTK tell the window manager to associate this
|
||||
// dialog with our non-GTK raw X11 window, which should try
|
||||
// to keep it on top etc.
|
||||
if (mX11WindowID != None)
|
||||
if (None != mX11WindowID)
|
||||
{
|
||||
gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
|
||||
GdkWindow *gdkwin = gdk_window_foreign_new(mX11WindowID);
|
||||
gdk_window_set_transient_for(GTK_WIDGET(win)->window, gdkwin);
|
||||
|
||||
#if GTK_CHECK_VERSION(2, 24, 0)
|
||||
GdkWindow *gdkwin = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), static_cast<Window>(mX11WindowID));
|
||||
#else
|
||||
GdkWindow *gdkwin = gdk_window_foreign_new(static_cast<GdkNativeWindow>(mX11WindowID));
|
||||
#endif
|
||||
|
||||
gdk_window_set_transient_for(gtk_widget_get_window(GTK_WIDGET(win)), gdkwin);
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Hmm, couldn't get xwid to use for transient." << LL_ENDL;
|
||||
}
|
||||
# endif //LL_X11
|
||||
|
||||
|
||||
@@ -43,6 +43,13 @@
|
||||
#include "legacy.h"
|
||||
#include <vector>
|
||||
|
||||
#if LL_GTK
|
||||
extern "C" {
|
||||
// mostly for Linux, possible on others
|
||||
# include <gtk/gtk.h>
|
||||
}
|
||||
#endif // LL_GTK
|
||||
|
||||
// This class is used as base class of a singleton and is therefore not
|
||||
// allowed to have any static members or static local variables!
|
||||
class LLFilePickerBase
|
||||
|
||||
Reference in New Issue
Block a user