]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/xywindow.cpp
Wrap some buffers
[xonotic/netradiant.git] / radiant / xywindow.cpp
index eb275baf0cabf37c778ed35c9f7978de9b8a6a9b..4e6b531e5aa1316257a27965c99ec1d9d426a924 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <uilib/uilib.h>
 #include <gdk/gdkkeysyms.h>
+#include <util/buffer.h>
 
 #include "generic/callback.h"
 #include "string/string.h"
@@ -412,6 +413,7 @@ inline unsigned int buttons_for_button_and_modifiers( ButtonIdentifier button, M
 
        switch ( button.get() )
        {
+    case ButtonEnumeration::INVALID: break;
        case ButtonEnumeration::LEFT: buttons |= RAD_LBUTTON; break;
        case ButtonEnumeration::MIDDLE: buttons |= RAD_MBUTTON; break;
        case ButtonEnumeration::RIGHT: buttons |= RAD_RBUTTON; break;
@@ -707,7 +709,7 @@ bool XYWnd::chaseMouseMotion( int pointx, int pointy ){
 Shader* XYWnd::m_state_selected = 0;
 
 void xy_update_xor_rectangle( XYWnd& self, rect_t area ){
-       if ( gtk_widget_get_visible( self.GetWidget() ) ) {
+       if ( self.GetWidget().visible() ) {
                self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) );
        }
 }
@@ -1111,7 +1113,7 @@ void pushMenu( const CopiedString& name ){
        item.show();
        m_stack.back().first.add(item);
 
-       auto submenu = ui::Menu();
+       auto submenu = ui::Menu(ui::New);
        gtk_menu_item_set_submenu( item, GTK_WIDGET( submenu ) );
 
        m_stack.push_back( MenuPair( submenu, name ) );
@@ -1154,7 +1156,7 @@ void XYWnd::OnContextMenu(){
        }
 
        if ( !m_mnuDrop ) { // first time, load it up
-               auto menu = m_mnuDrop = ui::Menu();
+               auto menu = m_mnuDrop = ui::Menu(ui::New);
 
                EntityClassMenuInserter inserter( menu );
                GlobalEntityClassManager().forEach( inserter );
@@ -1436,7 +1438,7 @@ void XYWnd::XY_LoadBackgroundImage( const char *name ){
                globalOutputStream() << "WARNING: could not extract the relative path, using full path instead\n";
        }
 
-       char fileNameWithoutExt[512];
+       auto fileNameWithoutExt = u::buffer<512>();
        strncpy( fileNameWithoutExt, relative, sizeof( fileNameWithoutExt ) - 1 );
        fileNameWithoutExt[512 - 1] = '\0';
        fileNameWithoutExt[strlen( fileNameWithoutExt ) - 4] = '\0';
@@ -1595,7 +1597,7 @@ void XYWnd::XY_DrawBackground( void ){
 void XYWnd::XY_DrawGrid( void ) {
        float x, y, xb, xe, yb, ye;
        float w, h, a;
-       char text[32];
+       auto text = u::buffer<32>();
        float step, minor_step, stepx, stepy;
        step = minor_step = stepx = stepy = GetGridSize();
 
@@ -1777,7 +1779,7 @@ void XYWnd::XY_DrawBlockGrid(){
 
        float x, y, xb, xe, yb, ye;
        float w, h;
-       char text[32];
+       auto text = u::buffer<32>();
 
        glDisable( GL_TEXTURE_2D );
        glDisable( GL_TEXTURE_1D );
@@ -2066,7 +2068,7 @@ void SetState( Shader* state, EStyle style ){
                m_state_stack.back().m_state = state;
        }
 }
-const EStyle getStyle() const {
+EStyle getStyle() const {
        return eWireframeOnly;
 }
 void PushState(){