[xiph-commits] r9679 - trunk/planarity
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Sun Jul 31 04:13:33 PDT 2005
Author: xiphmont
Date: 2005-07-31 04:13:29 -0700 (Sun, 31 Jul 2005)
New Revision: 9679
Modified:
trunk/planarity/button_base.c
trunk/planarity/finish.c
trunk/planarity/gameboard.c
trunk/planarity/gameboard.h
trunk/planarity/gamestate.c
trunk/planarity/pause.c
trunk/planarity/version.h
Log:
Correct two resize bugs: left buttons did not update Y, resize when a dialog was up did not redraw properly.
Modified: trunk/planarity/button_base.c
===================================================================
--- trunk/planarity/button_base.c 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/button_base.c 2005-07-31 11:13:29 UTC (rev 9679)
@@ -20,7 +20,6 @@
static int allclear=1; // actually just a shirt-circuit
static buttonstate *grabbed=0;
-
/* determine the x/y/w/h box around the rollover text */
static GdkRectangle rollover_box(buttonstate *b){
GdkRectangle r;
@@ -502,6 +501,12 @@
dy=h-height;
for(i=0;i<NUMBUTTONS;i++){
+ if(states[i].position == 1){
+ states[i].y+=dy;
+ }
+ }
+
+ for(i=0;i<NUMBUTTONS;i++){
if(states[i].position == 3){
states[i].x+=dx;
states[i].target_x+=dx;
Modified: trunk/planarity/finish.c
===================================================================
--- trunk/planarity/finish.c 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/finish.c 2005-07-31 11:13:29 UTC (rev 9679)
@@ -144,8 +144,6 @@
int w= get_board_width();
int h= get_board_height();
- push_background(g);
-
cairo_t *c = cairo_create(g->background);
borderbox_path(c,
w/2 - FINISHBOX_WIDTH/2,
@@ -228,7 +226,7 @@
setup_finish_buttons(g,FINISHBOX_WIDTH, FINISHBOX_HEIGHT);
// draw pausebox
- draw_finishbox(g);
+ push_background(g,draw_finishbox);
// deploy new buttons
callback=0;
Modified: trunk/planarity/gameboard.c
===================================================================
--- trunk/planarity/gameboard.c 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/gameboard.c 2005-07-31 11:13:29 UTC (rev 9679)
@@ -823,7 +823,7 @@
}
}
-void push_background(Gameboard *g){
+void push_background(Gameboard *g, void(*redraw_callback)(Gameboard *g)){
cairo_t *c = cairo_create(g->background);
int w = g->w.allocation.width;
int h = g->w.allocation.height;
@@ -831,6 +831,8 @@
if(g->pushed_background)
pop_background(g);
+ g->redraw_callback=redraw_callback;
+
foreground_draw(g,c,0,0,w,h);
// copy in the score and button surfaces
@@ -850,9 +852,10 @@
}else{
expose_intersections(g,c,0,0,w,h);
}
-
cairo_destroy(c);
+ if(redraw_callback)redraw_callback(g);
+
g->pushed_background=1;
{
GdkRectangle r;
@@ -1074,10 +1077,18 @@
// also verifies all verticies are onscreen
resize_board(allocation->width,allocation->height);
- update_background(widget);
- paint_bottom_box(g);
- score_update(g);
- resize_buttons(widget->allocation.width,widget->allocation.height);
+ {
+ int flag = g->pushed_background;
+ if(flag)pop_background(g);
+
+ update_background(widget);
+ paint_bottom_box(g);
+ score_update(g);
+ resize_buttons(widget->allocation.width,widget->allocation.height);
+
+ if(flag)push_background(g,g->redraw_callback);
+
+ }
}
}
Modified: trunk/planarity/gameboard.h
===================================================================
--- trunk/planarity/gameboard.h 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/gameboard.h 2005-07-31 11:13:29 UTC (rev 9679)
@@ -36,6 +36,7 @@
GtkWidget w;
int pushed_background;
+ void (*redraw_callback)(Gameboard *g);
cairo_t *wc;
cairo_surface_t *vertex;
@@ -103,4 +104,4 @@
extern double get_curtain(Gameboard *g);
extern void set_curtain(Gameboard *g, double alpha);
extern void pop_background(Gameboard *g);
-extern void push_background(Gameboard *g);
+extern void push_background(Gameboard *g, void (*callback)(Gameboard *g));
Modified: trunk/planarity/gamestate.c
===================================================================
--- trunk/planarity/gamestate.c 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/gamestate.c 2005-07-31 11:13:29 UTC (rev 9679)
@@ -1,4 +1,5 @@
#include <math.h>
+#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "graph.h"
Modified: trunk/planarity/pause.c
===================================================================
--- trunk/planarity/pause.c 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/pause.c 2005-07-31 11:13:29 UTC (rev 9679)
@@ -128,8 +128,6 @@
int w= get_board_width();
int h= get_board_height();
- push_background(g);
-
cairo_t *c = cairo_create(g->background);
borderbox_path(c,
w/2 - PAUSEBOX_WIDTH/2,
@@ -190,7 +188,7 @@
setup_pause_buttons(g,PAUSEBOX_WIDTH, PAUSEBOX_HEIGHT);
// draw pausebox
- draw_pausebox(g);
+ push_background(g,draw_pausebox);
// deploy new buttons
callback=0;
@@ -213,8 +211,6 @@
int w= get_board_width();
int h= get_board_height();
- push_background(g);
-
cairo_t *c = cairo_create(g->background);
borderbox_path(c,
w/2 - ABOUTBOX_WIDTH/2,
@@ -301,7 +297,7 @@
setup_pause_buttons(g,ABOUTBOX_WIDTH,ABOUTBOX_HEIGHT);
// draw about box
- draw_aboutbox(g);
+ push_background(g,draw_aboutbox);
// deploy new buttons
callback=0;
Modified: trunk/planarity/version.h
===================================================================
--- trunk/planarity/version.h 2005-07-31 07:51:38 UTC (rev 9678)
+++ trunk/planarity/version.h 2005-07-31 11:13:29 UTC (rev 9679)
@@ -1,2 +1,2 @@
#define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Sun Jul 31 02:52:04 EDT 2005] */
+/* DO NOT EDIT: Automated versioning hack [Sun Jul 31 07:12:39 EDT 2005] */
More information about the commits
mailing list