mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Replace deprecated gdk_cursor_new
This commit is contained in:
parent
16453c6ac2
commit
743a6a9a34
4 changed files with 63 additions and 43 deletions
|
@ -307,9 +307,16 @@ static void motion( GtkWidget *widget, GdkEventMotion *event, gpointer data ){
|
|||
g_GLTable.m_pfn_qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
if ( PtInRect( &rcGrid,pt ) ) {
|
||||
GdkCursor *cursor = gdk_cursor_new( GDK_CROSS );
|
||||
gdk_window_set_cursor( gtk_widget_get_window( g_pWndPreview ), cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
window = gtk_widget_get_window( g_pWndPreview );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_CROSS );
|
||||
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
g_object_unref( cursor );
|
||||
|
||||
char Text[32];
|
||||
int x, y;
|
||||
|
|
|
@ -490,26 +490,15 @@ void CamWnd::ToggleFreeMove(){
|
|||
}
|
||||
|
||||
if ( m_bFreeMove ) {
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
SetFocus();
|
||||
SetCapture();
|
||||
|
||||
{
|
||||
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( NULL, buffer, 32, 32 );
|
||||
mask = gdk_bitmap_create_from_data( NULL, buffer, 32, 32 );
|
||||
GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
|
||||
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_BLANK_CURSOR );
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
gdk_drawable_unref( pixmap );
|
||||
gdk_drawable_unref( mask );
|
||||
}
|
||||
|
||||
// RR2DO2: FIXME why does this only work the 2nd and
|
||||
// further times the event is called? (floating windows
|
||||
|
@ -529,16 +518,22 @@ void CamWnd::ToggleFreeMove(){
|
|||
|
||||
gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, gtk_widget_get_window( widget ), NULL, GDK_CURRENT_TIME );
|
||||
}
|
||||
g_object_unref( cursor );
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
gdk_pointer_ungrab( GDK_CURRENT_TIME );
|
||||
|
||||
g_signal_handler_disconnect( G_OBJECT( widget ), m_FocusOutHandler_id );
|
||||
|
||||
GdkCursor *cursor = gdk_cursor_new( GDK_LEFT_PTR );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_LEFT_PTR );
|
||||
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
g_object_unref( cursor );
|
||||
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
|
|
@ -1280,16 +1280,32 @@ void Sys_SetTitle( const char *text ){
|
|||
bool g_bWaitCursor = false;
|
||||
|
||||
void WINAPI Sys_BeginWait( void ){
|
||||
GdkCursor *cursor = gdk_cursor_new( GDK_WATCH );
|
||||
gdk_window_set_cursor( gtk_widget_get_window( g_pParentWnd->m_pWidget ), cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
window = gtk_widget_get_window( g_pParentWnd->m_pWidget );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_WATCH );
|
||||
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
g_object_unref( cursor );
|
||||
|
||||
g_bWaitCursor = true;
|
||||
}
|
||||
|
||||
void WINAPI Sys_EndWait( void ){
|
||||
GdkCursor *cursor = gdk_cursor_new( GDK_LEFT_PTR );
|
||||
gdk_window_set_cursor( gtk_widget_get_window( g_pParentWnd->m_pWidget ), cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
window = gtk_widget_get_window( g_pParentWnd->m_pWidget );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_LEFT_PTR );
|
||||
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
g_object_unref( cursor );
|
||||
|
||||
g_bWaitCursor = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1165,10 +1165,15 @@ void XYWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){
|
|||
|
||||
if ( ( nFlags & MK_RBUTTON ) == 0 ) {
|
||||
if ( bCrossHair && !g_bWaitCursor ) {
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
cursor = gdk_cursor_new( GDK_CROSSHAIR );
|
||||
gdk_window_set_cursor( gtk_widget_get_window( m_pWidget ), cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
|
||||
window = gtk_widget_get_window( m_pWidget );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_CROSSHAIR );
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
g_object_unref( cursor );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1833,19 +1838,16 @@ void XYWnd::XY_MouseMoved( int x, int y, int buttons ){
|
|||
|
||||
// create an empty cursor
|
||||
if ( !g_bWaitCursor ) {
|
||||
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( NULL, buffer, 32, 32 );
|
||||
mask = gdk_bitmap_create_from_data( NULL, buffer, 32, 32 );
|
||||
GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
|
||||
gdk_window_set_cursor( gtk_widget_get_window( m_pWidget ), cursor );
|
||||
gdk_cursor_unref( cursor );
|
||||
gdk_drawable_unref( pixmap );
|
||||
gdk_drawable_unref( mask );
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkCursor *cursor;
|
||||
|
||||
window = gtk_widget_get_window( m_pWidget );
|
||||
display = gdk_window_get_display( window );
|
||||
cursor = gdk_cursor_new_for_display( display, GDK_BLANK_CURSOR );
|
||||
|
||||
gdk_window_set_cursor( window, cursor );
|
||||
g_object_unref( cursor );
|
||||
}
|
||||
|
||||
Sys_UpdateWindows( W_XY | W_XY_OVERLAY );
|
||||
|
|
Loading…
Reference in a new issue