#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#if 0
++// Note: NetRadiantCustom disables them but we still make use of them.
++#if 1
GdkCursor* create_blank_cursor(){
- return gdk_cursor_new( GDK_BLANK_CURSOR );
+ return gdk_cursor_new(GDK_BLANK_CURSOR);
}
-void blank_cursor( ui::Widget widget ){
- GdkCursor* cursor = create_blank_cursor();
+void set_cursor( ui::Widget widget, GdkCursorType cursor_type ){
+ GdkCursor* cursor = gdk_cursor_new( cursor_type );
- gdk_window_set_cursor( gtk_widget_get_window( widget ), cursor );
+ gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
gdk_cursor_unref( cursor );
}
+void blank_cursor( ui::Widget widget ){
+ set_cursor( widget, GDK_BLANK_CURSOR );
+}
+
void default_cursor( ui::Widget widget ){
- gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
+ gdk_window_set_cursor( gtk_widget_get_window( widget ), NULL );
}
+ #endif
-
-void Sys_GetCursorPos( ui::Window window, int *x, int *y ){
- gdk_display_get_pointer( gdk_display_get_default(), 0, x, y, 0 );
+void Sys_GetCursorPos( ui::Widget widget, int *x, int *y ){
+ GdkDisplay *display = gtk_widget_get_display( GTK_WIDGET( widget ) );
+ // No need to store the screen, it will be recovered from widget again.
+ gdk_display_get_pointer( display, NULL, x, y, NULL );
}
-void Sys_SetCursorPos( ui::Window window, int x, int y ){
- GdkScreen *screen;
- gdk_display_get_pointer( gdk_display_get_default(), &screen, 0, 0, 0 );
- gdk_display_warp_pointer( gdk_display_get_default(), screen, x, y );
+void Sys_SetCursorPos( ui::Widget widget, int x, int y ){
+ GdkDisplay *display = gtk_widget_get_display( GTK_WIDGET( widget ) );
+ GdkScreen *screen = gtk_widget_get_screen( GTK_WIDGET( widget ) );
+ gdk_display_warp_pointer( display, screen, x, y );
}
gboolean DeferredMotion::gtk_motion(ui::Widget widget, GdkEventMotion *event, DeferredMotion *self)
m_function = 0;
m_data = 0;
- Sys_SetCursorPos( window, recorded_x, recorded_y );
+#if defined(WORKAROUND_MACOS_GTK2_LAGGYPOINTER)
+ /* The pointer was visible during all the move operation,
+ so, keep the current position. */
+#else
++ // Note: NetRadiantCustom still uses window instead of widget.
+ Sys_SetCursorPos( widget, recorded_x, recorded_y );
+#endif
gdk_pointer_ungrab( GDK_CURRENT_TIME );
}
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkEventMotion GdkEventMotion;
-#if 0
++// Note: NetRadiantCustom disables them but we still make use of them.
++#if 1
GdkCursor* create_blank_cursor();
+void set_cursor( ui::Widget widget, GdkCursorType cursor_type );
void blank_cursor( ui::Widget widget );
void default_cursor( ui::Widget widget );
-void Sys_GetCursorPos( ui::Window window, int *x, int *y );
-void Sys_SetCursorPos( ui::Window window, int x, int y );
-
-
+ #endif
+void Sys_GetCursorPos( ui::Widget widget, int *x, int *y );
+void Sys_SetCursorPos( ui::Widget widget, int x, int y );
class DeferredMotion
{
class FreezePointer
{
unsigned int handle_motion;
- int recorded_x, recorded_y, last_x, last_y;
+ int recorded_x, recorded_y, last_x, last_y, center_x, center_y;
-GtkWidget* weedjet;
typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data );
MotionDeltaFunction m_function;
void* m_data;
gtk_window_set_focus( m_parent, m_gl_widget );
m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
- m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera );
++ /* Note: We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
++ m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera ); */
+ m_freezePointer.freeze_pointer( m_gl_widget, Camera_motionDelta, &m_Camera );
CamWnd_Update( *this );
}
vbox.pack_start( split, TRUE, TRUE, 0 );
{
- auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
+ 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
+
+ WORKAROUND_GOBJECT_SET_GLWIDGET( window, TextureBrowser_getGLWidget() );
}
}
+ else // single window
+ {
+ m_pCamWnd = NewCamWnd();
+ GlobalCamera_setCamWnd( *m_pCamWnd );
+ CamWnd_setParent( *m_pCamWnd, window );
+
+ ui::Widget camera = CamWnd_getWidget( *m_pCamWnd );
+
+ m_pYZWnd = new XYWnd();
+ m_pYZWnd->SetViewType( YZ );
+
+ ui::Widget yz = m_pYZWnd->GetWidget();
+
+ m_pXYWnd = new XYWnd();
+ m_pXYWnd->SetViewType( XY );
+
+ ui::Widget xy = m_pXYWnd->GetWidget();
+
+ m_pXZWnd = new XYWnd();
+ m_pXZWnd->SetViewType( XZ );
+
+ ui::Widget xz = m_pXZWnd->GetWidget();
+
+ ui::Widget hsplit = ui::HPaned(ui::New);
+ vbox.pack_start( hsplit, TRUE, TRUE, 0 );
+ hsplit.show();
+
+ ui::Widget split = create_split_views( camera, yz, xy, xz );
+
+ ui::Widget vsplit = ui::VPaned(ui::New);
+ vsplit.show();
+
+ // textures
+ ui::Widget texture_window = create_framed_widget( TextureBrowser_constructWindow( window ) );
+
+ // console
+ ui::Widget console_window = create_framed_widget( Console_constructWindow( window ) );
+
+ gtk_paned_add1( GTK_PANED( hsplit ), split );
+ gtk_paned_add2( GTK_PANED( hsplit ), vsplit );
+
+ gtk_paned_add1( GTK_PANED( vsplit ), texture_window );
+ gtk_paned_add2( GTK_PANED( vsplit ), console_window );
+
+ hsplit.connect( "size_allocate", G_CALLBACK( hpaned_allocate ), &g_single_hpaned );
+ hsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_hpaned );
+
+ vsplit.connect( "size_allocate", G_CALLBACK( vpaned_allocate ), &g_single_vpaned );
+ vsplit.connect( "notify::position", G_CALLBACK( paned_position ), &g_single_vpaned );
+ }
EntityList_constructWindow( window );
PreferencesDialog_constructWindow( window );
}
}
- void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
- textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
- }
-
void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){
- textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_parent );
+ textureBrowser.m_move_started = false;
++ /* Note: NetRadiantCustom did this instead:
++ textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); */
++
+ textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget );
}
- textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
+ void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
+ if( textureBrowser.m_move_started ){
+ TextureBrowser_Tracking_MouseUp( textureBrowser );
+ }
+ textureBrowser.m_move_started = true;
++ /* Note: NetRadiantCustom did this instead:
++ textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); */
++ textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
+ }
+
void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, ( flags & GDK_SHIFT_MASK ) != 0 );
}
m_parent( ui::null ),
m_window_observer( NewWindowObserver() ),
m_XORRectangle( m_gl_widget ),
- m_chasemouse_handler( 0 ) {
+ m_chasemouse_handler( 0 ){
+
m_bActive = false;
m_buttonstate = 0;
g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );
}
else {
- GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(), "There's already a worldspawn in your map!"
- "",
+ GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(),
+ "There's already a worldspawn in your map!",
- "Info",
- eMB_OK,
- eMB_ICONDEFAULT );
+ "Info",
+ eMB_OK,
+ eMB_ICONDEFAULT );
}
}
Move_End();
}
m_move_started = true;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
++ /* Note: NetRadiantCustom did this instead:
++ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */
+ g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this );
m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
}
}
m_zoom_started = true;
g_dragZoom = 0;
- g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
++ /* Note: NetRadiantCustom did this instead:
++ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */
+ g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
}