Add button to event info
This commit is contained in:
parent
7beb2b24ac
commit
94214ba6e7
@ -186,7 +186,7 @@ _wrap_sugar_browser_event_tp_getattr(PyObject *self, char *attr)
|
||||
SugarBrowserEvent *event = pyg_boxed_get(self, SugarBrowserEvent);
|
||||
|
||||
if (!strcmp(attr, "__members__"))
|
||||
return Py_BuildValue("[s]", "image_uri");
|
||||
return Py_BuildValue("[ss]", "image_uri", "button");
|
||||
if (!strcmp(attr, "image_uri")) {
|
||||
if (event->image_uri) {
|
||||
return PyString_FromString(event->image_uri);
|
||||
@ -195,6 +195,8 @@ _wrap_sugar_browser_event_tp_getattr(PyObject *self, char *attr)
|
||||
return Py_None;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(attr, "button"))
|
||||
return PyInt_FromLong(event->button);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -424,8 +424,14 @@ dom_mouse_click_cb(GtkMozEmbed *embed, nsIDOMMouseEvent *mouseEvent)
|
||||
}
|
||||
}
|
||||
|
||||
PRUint16 btn = 0;
|
||||
mouseEvent->GetButton (&btn);
|
||||
event->button = btn + 1;
|
||||
|
||||
g_signal_emit(browser, signals[MOUSE_CLICK], 0, event, &return_value);
|
||||
|
||||
sugar_browser_event_free(event);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ void sugar_browser_shutdown (void);
|
||||
#define SUGAR_TYPE_BROWSER_EVENT (sugar_browser_event_get_type())
|
||||
|
||||
struct _SugarBrowserEvent {
|
||||
int button;
|
||||
char *image_uri;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user