[Swfdec] 2 commits - README src/plugin_x11.c src/swfmoz_player.c src/swfmoz_player.h
Benjamin Otte
company at kemper.freedesktop.org
Thu Nov 29 02:19:02 PST 2007
README | 9 +----
src/plugin_x11.c | 10 ++++--
src/swfmoz_player.c | 79 ++++++++++++++++++++++++++++++----------------------
src/swfmoz_player.h | 12 ++++---
4 files changed, 62 insertions(+), 48 deletions(-)
New commits:
commit 0f483c3be7209908e4a58c45371b72bb55d61b4a
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 29 11:18:55 2007 +0100
recode mouse input handling
This updates the API to the recent changes in Swfdec.
diff --git a/src/plugin_x11.c b/src/plugin_x11.c
index 4ea42ac..a118c24 100644
--- a/src/plugin_x11.c
+++ b/src/plugin_x11.c
@@ -53,11 +53,15 @@ plugin_x11_handle_event (GdkXEvent *gdkxevent, GdkEvent *unused, gpointer player
break;
}
case ButtonPress:
+ {
+ XButtonEvent *button = (XButtonEvent *) event;
+ swfmoz_player_mouse_press (player, button->x, button->y, button->button);
+ break;
+ }
case ButtonRelease:
{
XButtonEvent *button = (XButtonEvent *) event;
- swfmoz_player_mouse_changed (player, button->button, button->x,
- button->y, event->type == ButtonPress);
+ swfmoz_player_mouse_release (player, button->x, button->y, button->button);
break;
}
case EnterNotify:
@@ -69,7 +73,7 @@ plugin_x11_handle_event (GdkXEvent *gdkxevent, GdkEvent *unused, gpointer player
int winx, winy;
gdk_window_get_pointer (player->target, &winx, &winy, NULL);
- swfmoz_player_mouse_moved (player, winx, winy);
+ swfmoz_player_mouse_move (player, winx, winy);
break;
}
case KeyPress:
diff --git a/src/swfmoz_player.c b/src/swfmoz_player.c
index 5609ea9..8744de1 100644
--- a/src/swfmoz_player.c
+++ b/src/swfmoz_player.c
@@ -626,50 +626,63 @@ swfmoz_player_render (SwfmozPlayer *player, GdkRegion *region)
}
gboolean
-swfmoz_player_mouse_changed (SwfmozPlayer *player, int button, int x, int y, gboolean down)
+swfmoz_player_mouse_press (SwfmozPlayer *player, int x, int y, guint button)
{
+ gboolean ret = FALSE;
+
g_return_val_if_fail (SWFMOZ_IS_PLAYER (player), FALSE);
- switch (button) {
- case 1:
- if (player->menu != NULL) {
- g_signal_handlers_disconnect_matched (player->player, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- swfmoz_player_menu_notify_playing, NULL);
- g_signal_handlers_disconnect_matched (player->player, G_SIGNAL_MATCH_FUNC, 0, 0, NULL,
- swfmoz_player_menu_notify_audio, NULL);
- gtk_widget_destroy (GTK_WIDGET (player->menu));
- player->menu = NULL;
- return TRUE;
- }
- if (!swfdec_gtk_player_get_playing (SWFDEC_GTK_PLAYER (player->player))) {
- if (!down)
- return FALSE;
- swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player->player), TRUE);
- } else {
- player->mouse_down = down;
- plugin_push_allow_popups (player->instance, TRUE);
- swfdec_player_handle_mouse (player->player, x, y, down ? 1 : 0);
- plugin_pop_allow_popups (player->instance);
- }
- return TRUE;
- case 3:
- if (!down) {
- swfmoz_player_popup_menu (player);
- return TRUE;
- }
- default:
- break;
+ if (button > 32)
+ return FALSE;
+
+ if (player->menu && GTK_WIDGET_VISIBLE (player->menu))
+ gtk_menu_popdown (GTK_MENU (player->menu));
+
+ if (swfdec_gtk_player_get_playing (SWFDEC_GTK_PLAYER (player->player))) {
+ plugin_push_allow_popups (player->instance, TRUE);
+ ret = swfdec_player_mouse_press (player->player, x, y, button);
+ plugin_pop_allow_popups (player->instance);
}
- return FALSE;
+ return ret;
+}
+
+gboolean
+swfmoz_player_mouse_release (SwfmozPlayer *player, int x, int y, guint button)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (SWFMOZ_IS_PLAYER (player), FALSE);
+
+ if (button > 32)
+ return FALSE;
+
+ if (swfdec_gtk_player_get_playing (SWFDEC_GTK_PLAYER (player->player))) {
+ plugin_push_allow_popups (player->instance, TRUE);
+ ret = swfdec_player_mouse_release (player->player, x, y, button);
+ plugin_pop_allow_popups (player->instance);
+ } else {
+ if (button == 1) {
+ swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player->player), TRUE);
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
+ }
+
+ if (button == 3) {
+ swfmoz_player_popup_menu (player);
+ ret = TRUE;
+ }
+ return ret;
}
gboolean
-swfmoz_player_mouse_moved (SwfmozPlayer *player, int x, int y)
+swfmoz_player_mouse_move (SwfmozPlayer *player, int x, int y)
{
g_return_val_if_fail (SWFMOZ_IS_PLAYER (player), FALSE);
if (swfdec_gtk_player_get_playing (SWFDEC_GTK_PLAYER (player->player))) {
- swfdec_player_handle_mouse (player->player, x, y, player->mouse_down ? 1 : 0);
+ swfdec_player_mouse_move (player->player, x, y);
}
return FALSE;
}
diff --git a/src/swfmoz_player.h b/src/swfmoz_player.h
index 1ae1fc9..2da826e 100644
--- a/src/swfmoz_player.h
+++ b/src/swfmoz_player.h
@@ -59,7 +59,6 @@ struct _SwfmozPlayer {
gboolean windowless; /* TRUE if player communicates with the windowing system via the browser */
GdkWindow * target; /* what we draw to */
GdkRectangle target_rect; /* area in target that this plugin occupies */
- gboolean mouse_down; /* saved state for the mouse */
/* for windowed operation */
GSource * repaint_source; /* set when repaint is necessary */
@@ -90,12 +89,15 @@ void swfmoz_player_set_target (SwfmozPlayer * player,
int height);
void swfmoz_player_render (SwfmozPlayer * player,
GdkRegion * region);
-gboolean swfmoz_player_mouse_changed (SwfmozPlayer * player,
- int button,
+gboolean swfmoz_player_mouse_press (SwfmozPlayer * player,
int x,
int y,
- gboolean down);
-gboolean swfmoz_player_mouse_moved (SwfmozPlayer * player,
+ guint button);
+gboolean swfmoz_player_mouse_release (SwfmozPlayer * player,
+ int x,
+ int y,
+ guint button);
+gboolean swfmoz_player_mouse_move (SwfmozPlayer * player,
int x,
int y);
commit 330518557277e87bfcf42dedc0b2d2656f086724
Author: Benjamin Otte <otte at gnome.org>
Date: Thu Nov 29 10:03:03 2007 +0100
remove outdated cruft from README
diff --git a/README b/README
index eb2bbca..a94838c 100644
--- a/README
+++ b/README
@@ -19,14 +19,9 @@ Notes:
browsers by adding /usr/local/lib/mozilla/plugins to the
MOZ_PLUGIN_PATH environment variable.
- - Sound output is provided by libswfdec-gtk. It is currently only
- available for ALSA. If you want a different output, feel
- encouraged to provide patches.
-
Dependencies:
- swfdec (= 0.4.4)
- swfdec-gtk (= 0.4.4)
- Mozilla (>= 1.0.0)
+ swfdec (= 0.5.4)
+ swfdec-gtk (= 0.5.4)
More information about the Swfdec
mailing list