Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #777701 ยป 0018-gtk3x-Replace-remaining-direct-accesses-to-GdkEvent-.patch

Marko Lindqvist, 2018-10-04 02:19 PM

View differences:

client/gui-gtk-4.0/cma_fe.c
type = gdk_event_get_event_type(ev);
if (type == GDK_BUTTON_PRESS) {
cma_activate_preset_callback(view, path, column, data);
} else if (type == GDK_2BUTTON_PRESS) {
struct cma_dialog *pdialog = (struct cma_dialog *) data;
struct cm_parameter param;
guint click_count;
cmafec_get_fe_parameter(pdialog->pcity, &param);
cma_put_city_under_agent(pdialog->pcity, &param);
refresh_city_dialog(pdialog->pcity);
gdk_event_get_click_count(ev, &click_count);
if (click_count == 1) {
cma_activate_preset_callback(view, path, column, data);
} else if (click_count == 2) {
struct cma_dialog *pdialog = (struct cma_dialog *) data;
struct cm_parameter param;
cmafec_get_fe_parameter(pdialog->pcity, &param);
cma_put_city_under_agent(pdialog->pcity, &param);
refresh_city_dialog(pdialog->pcity);
}
}
}
gtk_tree_path_free(path);
client/gui-gtk-4.0/gui_stuff.c
/**********************************************************************//**
Allow the user to close a dialog using Escape or CTRL+W.
**************************************************************************/
static gboolean gui_dialog_key_press_handler(GtkWidget *w, GdkEventKey *ev,
static gboolean gui_dialog_key_press_handler(GtkWidget *w, GdkEvent *ev,
gpointer data)
{
GdkEventType type;
struct gui_dialog *dlg = data;
guint keyval;
GdkModifierType state;
if (ev->keyval == GDK_KEY_Escape
|| ((ev->state & GDK_CONTROL_MASK) && ev->keyval == GDK_KEY_w)) {
type = gdk_event_get_event_type(ev);
if (type != GDK_KEY_PRESS) {
return FALSE;
}
gdk_event_get_keyval(ev, &keyval);
gdk_event_get_state(ev, &state);
if (keyval == GDK_KEY_Escape
|| ((state & GDK_CONTROL_MASK) && keyval == GDK_KEY_w)) {
/* emit response signal. */
gui_dialog_response(dlg, GTK_RESPONSE_DELETE_EVENT);
}
......
/**********************************************************************//**
Someone has clicked on a label in a notebook
**************************************************************************/
static gboolean click_on_tab_callback(GtkWidget* w,
GdkEventButton* button,
static gboolean click_on_tab_callback(GtkWidget *w,
GdkEvent *button,
gpointer data)
{
if (button->type != GDK_2BUTTON_PRESS) {
GdkEventType type;
guint button_number;
type = gdk_event_get_event_type(button);
if (type != GDK_BUTTON_PRESS) {
return FALSE;
}
if (button->button != 1) {
gdk_event_get_button(button, &button_number);
if (button_number != 1) {
return FALSE;
}
gui_dialog_detach((struct gui_dialog*) data);
return TRUE;
}
client/gui-gtk-4.0/optiondlg.c
Called when a button is pressed on a option.
****************************************************************************/
static gboolean option_button_press_callback(GtkWidget *widget,
GdkEventButton *event,
GdkEvent *ev,
gpointer data)
{
struct option *poption = (struct option *) data;
GtkWidget *menu, *item;
GdkEventType type;
guint button;
if (3 != event->button || !option_is_changeable(poption)) {
type = gdk_event_get_event_type(ev);
if (type != GDK_BUTTON_PRESS) {
return FALSE;
}
gdk_event_get_button(ev, &button);
if (3 != button || !option_is_changeable(poption)) {
/* Only right button please! */
return FALSE;
}
client/gui-gtk-4.0/pages.c
Called on a button event on the pregame player list.
**************************************************************************/
static gboolean connection_list_event(GtkWidget *widget,
GdkEventButton *event,
GdkEvent *ev,
gpointer data)
{
GtkTreeView *tree = GTK_TREE_VIEW(widget);
GtkTreePath *path = NULL;
GtkTreeSelection *selection = gtk_tree_view_get_selection(tree);
gboolean ret = FALSE;
GdkEventType type;
guint button;
gdouble x, y;
if ((1 != event->button && 3 != event->button)
|| GDK_BUTTON_PRESS != event->type
type = gdk_event_get_event_type(ev);
gdk_event_get_button(ev, &button);
gdk_event_get_coords(ev, &x, &y);
if ((1 != button && 3 != button)
|| GDK_BUTTON_PRESS != type
|| !gtk_tree_view_get_path_at_pos(tree,
event->x, event->y,
x, y,
&path, NULL, NULL, NULL)) {
return FALSE;
}
if (1 == event->button) {
if (1 == button) {
if (gtk_tree_selection_path_is_selected(selection, path)) {
/* Need to delay to avoid problem with the expander. */
g_idle_add(delayed_unselect_path, path);
return FALSE; /* Return now, don't free the path. */
}
} else if (3 == event->button) {
} else if (3 == button) {
GtkTreeModel *model = gtk_tree_view_get_model(tree);
GtkTreeIter iter;
GtkWidget *menu;
client/gui-gtk-4.0/plrdlg.c
**************************************************************************/
static gboolean button_press_callback(GtkTreeView *view, GdkEvent *ev)
{
if (gdk_event_get_event_type(ev) == GDK_2BUTTON_PRESS) {
GtkTreePath *path;
gtk_tree_view_get_cursor(view, &path, NULL);
if (path) {
GtkTreeModel *model = gtk_tree_view_get_model(view);
GtkTreeIter it;
gint id;
struct player *plr;
guint button;
gtk_tree_model_get_iter(model, &it, path);
gtk_tree_path_free(path);
gtk_tree_model_get(model, &it, PLR_DLG_COL_ID, &id, -1);
plr = player_by_number(id);
gdk_event_get_button(ev, &button);
if (button == 1) {
if (can_intel_with_player(plr)) {
popup_intel_dialog(plr);
if (gdk_event_get_event_type(ev) == GDK_BUTTON_PRESS) {
guint click_count;
gdk_event_get_click_count(ev, &click_count);
if (click_count == 2) {
GtkTreePath *path;
gtk_tree_view_get_cursor(view, &path, NULL);
if (path) {
GtkTreeModel *model = gtk_tree_view_get_model(view);
GtkTreeIter it;
gint id;
struct player *plr;
guint button;
gtk_tree_model_get_iter(model, &it, path);
gtk_tree_path_free(path);
gtk_tree_model_get(model, &it, PLR_DLG_COL_ID, &id, -1);
plr = player_by_number(id);
gdk_event_get_button(ev, &button);
if (button == 1) {
if (can_intel_with_player(plr)) {
popup_intel_dialog(plr);
}
} else if (can_meet_with_player(plr)) {
dsend_packet_diplomacy_init_meeting_req(&client.conn, id);
}
} else if (can_meet_with_player(plr)) {
dsend_packet_diplomacy_init_meeting_req(&client.conn, id);
}
}
}
client/gui-gtk-4.0/repodlgs.c
static void science_report_combo_set_active(GtkComboBox *combo,
Tech_type_id tech);
static gboolean science_diagram_button_release_callback(GtkWidget *widget,
GdkEventButton *event, gpointer data);
GdkEvent *ev, gpointer data);
static gboolean science_diagram_update(GtkWidget *widget,
cairo_t *cr,
gpointer data);
......
Change tech goal, research or open help dialog.
****************************************************************************/
static gboolean science_diagram_button_release_callback(GtkWidget *widget,
GdkEventButton *event, gpointer data)
GdkEvent *ev, gpointer data)
{
const struct research *presearch = research_get(client_player());
struct reqtree *reqtree = g_object_get_data(G_OBJECT(widget), "reqtree");
Tech_type_id tech = get_tech_on_reqtree(reqtree, event->x, event->y);
Tech_type_id tech;
GdkEventType type;
gdouble x, y;
guint button;
type = gdk_event_get_event_type(ev);
if (type != GDK_BUTTON_RELEASE) {
return TRUE;
}
gdk_event_get_coords(ev, &x, &y);
gdk_event_get_button(ev, &button);
tech = get_tech_on_reqtree(reqtree, x, y);
if (tech == A_NONE) {
return TRUE;
}
if (event->button == 3) {
if (button == 3) {
/* RMB: get help */
popup_help_dialog_typed(research_advance_name_translation(presearch,
tech),
HELP_TECH);
} else {
if (event->button == 1 && can_client_issue_orders()) {
if (button == 1 && can_client_issue_orders()) {
/* LMB: set research or research goal */
switch (research_invention_state(research_get(client_player()),
tech)) {
    (1-1/1)