comparison gtk/browser.cpp @ 622:fb59f9eeeecd

SUpport for embedded mozilla/firefox widget
author mhessling@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 07 Apr 2008 06:59:45 +0000
parents
children
comparison
equal deleted inserted replaced
621:46c261153aa4 622:fb59f9eeeecd
1 #ifdef HAVE_CONFIG_H
2 # include <config.h>
3 #endif
4
5 #define MOZILLA_INTERNAL_API
6
7 #include <gtk/gtk.h>
8 #include <gtkmozembed.h>
9 #include <gtkmozembed_internal.h>
10 #include "nsIDOMMouseEvent.h"
11
12 /**
13 * Takes a pointer to a mouse event and returns the mouse
14 * button number or -1 on error.
15 */
16 extern "C" gint mozilla_get_mouse_event_button(gpointer event)
17 {
18 gint button = 0;
19 glong x,y;
20
21 g_return_val_if_fail (event, -1);
22
23 /* the following lines were found in the Galeon source */
24 nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent *) event;
25 aMouseEvent->GetButton ((PRUint16 *) &button);
26 aMouseEvent->GetClientX ((PRInt32 *) &x);
27 aMouseEvent->GetClientY ((PRInt32 *) &y);
28
29
30 /* for some reason we get different numbers on PPC, this fixes
31 * that up... -- MattA */
32 if (button == 65536)
33 {
34 button = 1;
35 }
36 else if (button == 131072)
37 {
38 button = 2;
39 }
40
41 return button;
42 }
43 extern "C" gint mozilla_get_mouse_location( gpointer event, glong *x, glong *y)
44 {
45 g_return_val_if_fail (event, -1);
46
47 /* the following lines were found in the Galeon source */
48 nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent *) event;
49 aMouseEvent->GetClientX ((PRInt32 *) x);
50 aMouseEvent->GetClientY ((PRInt32 *) y);
51 return 0;
52 }