X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=radiant%2Fcamwindow.cpp;h=005ab9b8893ce4607cceba0682a3df9de344b067;hb=74a6e43404e8a57fa1db66f9ee701cdd72ad0bdc;hp=a0c49d22021fded385483fa83fe90dcf1c74ae14;hpb=f7ec4500c417377b467509679011d64a047f17d7;p=xonotic%2Fnetradiant.git diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index a0c49d22..005ab9b8 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -322,17 +322,8 @@ void Camera_FreeMove( camera_t& camera, int dx, int dy ){ } void Cam_MouseControl( camera_t& camera, int x, int y ){ - int xl, xh; - int yl, yh; - float xf, yf; - - xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 ); - yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 ); - - xl = camera.width / 3; - xh = xl * 2; - yl = camera.height / 3; - yh = yl * 2; + float xf = (float)( x - camera.width / 2 ) / ( camera.width / 2 ); + float yf = (float)( y - camera.height / 2 ) / ( camera.height / 2 ); xf *= 1.0f - fabsf( yf ); if ( xf < 0 ) { @@ -828,7 +819,7 @@ gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, Ca #endif void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){ - if ( gtk_widget_get_visible( self.m_gl_widget ) ) { + if ( self.m_gl_widget.visible() ) { self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) ); } } @@ -854,8 +845,7 @@ void selection_motion( gdouble x, gdouble y, guint state, void* data ){ } inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){ - GtkAllocation allocation; - gtk_widget_get_allocation(widget, &allocation); + auto allocation = widget.dimensions(); return WindowVector( static_cast( allocation.width / 2 ), static_cast(allocation.height / 2 ) ); } @@ -1165,7 +1155,7 @@ CamWnd::CamWnd() : m_window_observer->setRectangleDrawCallback( ReferenceCaller1( *this ) ); m_window_observer->setView( m_view ); - g_object_ref( m_gl_widget ); + g_object_ref( m_gl_widget._handle ); gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); gtk_widget_set_can_focus( m_gl_widget, true ); @@ -1358,7 +1348,7 @@ void SetState( Shader* state, EStyle style ){ m_state_stack.back().m_state = state; } } -const EStyle getStyle() const { +EStyle getStyle() const { return eFullMaterials; } void PushState(){