GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 50a1c4ff authored by Bruno Coudoin's avatar Bruno Coudoin

Added a fix to let the fullscreen happen only when the window is mapped

parent 2c842c27
2005-12-05 Bruno coudoin <bruno.coudoin@free.fr>
Added a fix to let the fullscreen happen only when the window is mapped
* src/boards/python/electric.py:
* src/gcompris/gcompris.c: (setup_window),
(gcompris_set_fullscreen), (quit_cb), (map_cb):
2005-12-05 Yves Combe <yves@ycombe.net>
* src/boards/gtans.c: fixed widget being over the help
......
......@@ -273,7 +273,9 @@ class Gcompris_electric:
# A wire between 2 Nodes
class Wire:
wire_counter = 0
counter = 0
connection = {}
def __init__(self, rootitem, source_node, x1, y1, x2, y2):
self.rootitem = rootitem
self.source_node = source_node
......@@ -289,20 +291,47 @@ class Wire:
width_units=5.0
)
self.wire_item.connect("event", self.delete_wire, self)
self.wire_id = Wire.wire_counter
Wire.wire_counter += 1
self.wire_id = -1
self._add_connection(source_node)
def _add_connection(self, node):
# Is this node already connected
if Wire.connection.has_key(node):
wire_id = Wire.connection[node].get_wire_id()
print "Node already connected to %d" %wire_id
if self.wire_id >= 0:
# This node was already connected elsewhere, reset it to use our wire_id
for node in Wire.connection.keys():
if Wire.connection[node].get_wire_id() == wire_id:
Wire.connection[node].set_wire_id(self.wire_id)
else:
self.wire_id = wire_id
else:
if self.wire_id == -1:
self.wire_id = Wire.counter
Wire.counter += 1
Wire.connection[node] = self
print "WIRE_ID = %d" %self.wire_id
def set_wire_id(self, id):
self.wire_id = id
def get_wire_id(self):
return self.wire_id
def destroy(self):
self.wire_item.destroy()
self.wire_id = -1
self.source_node = None
self.target_node = None
def set_target_node(self, node):
self.target_node = node
self._add_connection(node)
# Move wire. In fact, the attached component are moved and THEY move the wire
def move_all_wire(self, x, y):
if(self.source_node and self.target_node):
......
......@@ -73,6 +73,7 @@ GnomeCanvas *canvas_bg;
//static gint pause_board_cb (GtkWidget *widget, gpointer data);
static void quit_cb (GtkWidget *widget, gpointer data);
static void map_cb (GtkWidget *widget, gpointer data);
static gint board_widget_key_press_callback (GtkWidget *widget,
GdkEventKey *event,
gpointer client_data);
......@@ -80,6 +81,7 @@ void gcompris_terminate(int signum);
GcomprisProperties *properties = NULL;
static gboolean antialiased = FALSE;
static gboolean is_mapped = FALSE;
/****************************************************************************/
/* Some constants. */
......@@ -650,6 +652,9 @@ static void setup_window ()
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (quit_cb), NULL);
gtk_signal_connect (GTK_OBJECT (window), "map_event",
GTK_SIGNAL_FUNC (map_cb), NULL);
/* For non anti alias canvas */
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
......@@ -825,7 +830,8 @@ void gcompris_set_fullscreen(gboolean state)
/* Set the Fullscreen now */
if(xr_previous_size_set)
{
xrandr_set_config( xrandr );
if(is_mapped)
xrandr_set_config( xrandr );
}
}
#endif
......@@ -888,6 +894,21 @@ static void quit_cb (GtkWidget *widget, gpointer data)
}
/*
* We want GCompris to be set as fullscreen the later possible
*
*/
static void map_cb (GtkWidget *widget, gpointer data)
{
if(is_mapped == FALSE)
{
is_mapped = TRUE;
gcompris_set_fullscreen(properties->fullscreen);
}
printf("\nEVENT\n============================================================\n\n");
}
/*
* Process the cleanup of the child (no zombies)
* ---------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment