Changeset 110


Ignore:
Timestamp:
Aug 14, 2010, 11:15:42 PM (10 years ago)
Author:
sam
Message:

Minor cleanup in the editor main code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gtk/editor.cpp

    r109 r110  
    5151static gint init(GtkWidget *widget)
    5252{
    53     /* OpenGL functions can be called only if make_current returns true */
    5453    if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
    55     {
    56         Video::Setup(widget->allocation.width,
    57                      widget->allocation.height);
    58     }
     54        Video::Setup(widget->allocation.width, widget->allocation.height);
     55
    5956    return TRUE;
     57}
     58
     59static gint reshape(GtkWidget *widget, GdkEventConfigure *event)
     60{
     61    (void)event;
     62
     63    return init(widget);
    6064}
    6165
    6266static gint draw(GtkWidget *widget, GdkEventExpose *event)
    6367{
    64     if (event->count == 0 && gtk_gl_area_make_current(GTK_GL_AREA(widget)))
     68    if (event->count > 0)
     69        return TRUE;
     70
     71    /* OpenGL functions can be called only if make_current returns true */
     72    if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
    6573    {
    6674        // FIXME: do not do anything if the game tick wasn't called?
     
    7381    }
    7482
    75     return TRUE;
    76 }
    77 
    78 static gint reshape(GtkWidget *widget, GdkEventConfigure *event)
    79 {
    80     (void)event;
    81 
    82     if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
    83     {
    84         Video::Setup(widget->allocation.width,
    85                      widget->allocation.height);
    86     }
    8783    return TRUE;
    8884}
Note: See TracChangeset for help on using the changeset viewer.