Commit e6da2a3b authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

rendering: Remove unneeded redraw after button release

parent f9fbd3fb
......@@ -61,10 +61,6 @@ typedef struct _EekGtkKeyboardPrivate
G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA)
static void render_pressed_button (GtkWidget *widget, struct button_place *place);
static void render_released_button (GtkWidget *widget,
const struct squeek_button *button);
static void
eek_gtk_keyboard_real_realize (GtkWidget *self)
{
......@@ -341,47 +337,3 @@ eek_gtk_render_locked_button (EekGtkKeyboard *self, struct button_place place)
cairo_region_destroy (region);
}
// TODO: does it really redraw the entire keyboard?
static void
render_released_button (GtkWidget *widget,
const struct squeek_button *button)
{
(void)button;
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
GdkWindow *window = gtk_widget_get_window (widget);
cairo_region_t *region = gdk_window_get_clip_region (window);
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
eek_renderer_render_keyboard (priv->renderer, cr);
gdk_window_end_draw_frame (window, context);
cairo_region_destroy (region);
}
void
eek_gtk_on_button_released (const struct squeek_button *button,
struct squeek_view *view,
EekGtkKeyboard *self)
{
(void)view;
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_released_button (GTK_WIDGET(self), button);
gtk_widget_queue_draw (GTK_WIDGET(self));
#if HAVE_LIBCANBERRA
ca_gtk_play_for_widget (widget, 0,
CA_PROP_EVENT_ID, "button-released",
CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
NULL);
#endif
}
......@@ -308,16 +308,6 @@ pub mod c {
origin: Point,
angle: i32
) -> u32;
// Button and View are safe to pass to C
// as long as they don't outlive the call
// and nothing dereferences them
#[allow(improper_ctypes)]
pub fn eek_gtk_on_button_released(
button: *const Button,
view: *const View,
keyboard: EekGtkKeyboard,
);
}
/// Places each button in order, starting from 0 on the left,
......@@ -904,24 +894,6 @@ mod procedures {
c::procedures::eek_are_bounds_inside(bounds, point, origin, angle)
}) == 1
}
/// Switch off all UI buttons associated with the (state) key
pub fn release_ui_buttons(
view: &Box<View>,
key: &Rc<RefCell<KeyState>>,
ui_keyboard: c::EekGtkKeyboard,
) {
let paths = ::layout::procedures::find_key_paths(&view, key);
for (_row, button) in paths {
unsafe {
c::procedures::eek_gtk_on_button_released(
button.as_ref() as *const Button,
view.as_ref() as *const View,
ui_keyboard,
);
};
}
}
#[cfg(test)]
mod test {
......@@ -1036,9 +1008,6 @@ mod seat {
);
}
}
// TODO: move one level up; multiple buttons might have been released
procedures::release_ui_buttons(view, key, ui_keyboard);
}
}
......
Supports Markdown
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