#include "stream/textstream.h"
#include <string.h>
-#include <gdk/gdkcursor.h>
-#include <gdk/gdkpixmap.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
-
+ #if 0
GdkCursor* create_blank_cursor(){
- GdkPixmap *pixmap;
- GdkBitmap *mask;
- char buffer [( 32 * 32 ) / 8];
- memset( buffer, 0, ( 32 * 32 ) / 8 );
- GdkColor white = {0, 0xffff, 0xffff, 0xffff};
- GdkColor black = {0, 0x0000, 0x0000, 0x0000};
- pixmap = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
- mask = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
- GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
- gdk_drawable_unref( pixmap );
- gdk_drawable_unref( mask );
-
- return cursor;
+ return gdk_cursor_new(GDK_BLANK_CURSOR);
}
-void blank_cursor( GtkWidget* widget ){
+void blank_cursor( ui::Widget widget ){
GdkCursor* cursor = create_blank_cursor();
- gdk_window_set_cursor( widget->window, cursor );
+ gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
gdk_cursor_unref( cursor );
}
-void default_cursor( GtkWidget* widget ){
- gdk_window_set_cursor( widget->window, 0 );
+void default_cursor( ui::Widget widget ){
+ gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
}
+ #endif
-void Sys_GetCursorPos( GtkWindow* window, int *x, int *y ){
+void Sys_GetCursorPos( ui::Window window, int *x, int *y ){
gdk_display_get_pointer( gdk_display_get_default(), 0, x, y, 0 );
}
#include "debugging/debugging.h"
typedef struct _GdkCursor GdkCursor;
-typedef struct _GtkWidget GtkWidget;
-typedef struct _GtkWindow GtkWindow;
+typedef struct _GdkEventMotion GdkEventMotion;
+ #if 0
GdkCursor* create_blank_cursor();
-void blank_cursor( GtkWidget* widget );
-void default_cursor( GtkWidget* widget );
+void blank_cursor( ui::Widget widget );
+void default_cursor( ui::Widget widget );
+ #endif
-void Sys_GetCursorPos( GtkWindow* window, int *x, int *y );
-void Sys_SetCursorPos( GtkWindow* window, int x, int y );
+void Sys_GetCursorPos( ui::Window window, int *x, int *y );
+void Sys_SetCursorPos( ui::Window window, int x, int y );
CamWnd_Add_Handlers_FreeMove( *this );
gtk_window_set_focus( m_parent, m_gl_widget );
- m_freemove_handle_focusout = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
+ m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
- m_freezePointer.freeze_pointer( m_parent, Camera_motionDelta, &m_Camera );
+ m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera );
CamWnd_Update( *this );
}
}
else if ( file_exists( path.c_str() ) ){
globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
- ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", path.c_str(), 0, 0, SW_SHOW );
+ ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", path.c_str(), 0, 0, SW_SHOW );
}
else{
- globalOutputStream() << "Failed to open '" << filename << "\n";
+ globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
}
return;
}
m_pXZWnd = new XYWnd();
m_pXZWnd->SetViewType( XZ );
- GtkWidget* xz = m_pXZWnd->GetWidget();
+ ui::Widget xz = m_pXZWnd->GetWidget();
- GtkHPaned* split = create_split_views( camera, yz, xy, xz );
- gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( split ), TRUE, TRUE, 0 );
+ auto split = create_split_views( camera, yz, xy, xz );
+ vbox.pack_start( split, TRUE, TRUE, 0 );
{
- auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
- GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
- g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
++ auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
+ g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
+#ifndef GARUX_GTK_WORKAROUND
/* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
+#endif
}
}
// The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
int m_uniformTextureSize;
int m_uniformTextureMinSize;
+
// Return the display width of a texture in the texture browser
- /*void getTextureWH( qtexture_t* tex, int *width, int *height ){
- if ( !g_TextureBrowser_fixedSize ) {
- // Don't use uniform size
- *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
- *height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
-
- }
- else if ( tex->width >= tex->height ) {
- // Texture is square, or wider than it is tall
- if ( tex->width >= m_uniformTextureSize ){
- *width = m_uniformTextureSize;
- *height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
- }
- else if ( tex->width <= m_uniformTextureMinSize ){
- *width = m_uniformTextureMinSize;
- *height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
- }
- else {
- *width = tex->width;
- *height = tex->height;
- }
- }
- else {
- // Texture taller than it is wide
- if ( tex->height >= m_uniformTextureSize ){
- *height = m_uniformTextureSize;
- *width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
- }
- else if ( tex->height <= m_uniformTextureMinSize ){
- *height = m_uniformTextureMinSize;
- *width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
- }
- else {
- *width = tex->width;
- *height = tex->height;
- }
- }
- }
-
- */
void getTextureWH( qtexture_t* tex, int &W, int &H ){
// Don't use uniform size
W = (int)( tex->width * ( (float)m_textureScale / 100 ) );
Move_End();
}
m_move_started = true;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
- m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
++ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
+ m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
void XYWnd::Move_End(){
}
m_zoom_started = true;
g_dragZoom = 0;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
- g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
- m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
++ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
+ m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
}
void XYWnd::Zoom_End(){