71 gdk_seat_ungrab(gdk_device_get_seat(ev->device));
72 gtk_widget_destroy(w);
92 gint minx, miny, maxy;
94 gdk_window_get_origin(gtk_widget_get_window(
map_canvas), &minx, &miny);
95 maxy = miny + gtk_widget_get_allocated_height(
map_canvas);
102 y =
CLIP(miny, y, maxy - alloc->height);
104 gtk_window_move(GTK_WINDOW(w), x - alloc->width, y);
110 y =
CLIP(miny, y, maxy - alloc->height);
112 gtk_window_move(GTK_WINDOW(w), x, y);
121static void popit(GdkEventButton *ev,
struct tile *ptile)
128 p = gtk_window_new(GTK_WINDOW_POPUP);
129 gtk_container_set_border_width(GTK_CONTAINER(p), 4);
130 gtk_window_set_transient_for(GTK_WINDOW(p), GTK_WINDOW(
toplevel));
131 gtk_container_add(GTK_CONTAINER(p), gtk_label_new(
popup_info_text(ptile)));
143 g_signal_connect(p,
"destroy",
149 g_signal_connect(p,
"size-allocate",
153 gtk_widget_show_all(p);
154 gdk_seat_grab(gdk_device_get_seat(ev->device), gtk_widget_get_window(p),
155 GDK_SEAT_CAPABILITY_ALL_POINTING,
156 TRUE, NULL, (GdkEvent *)ev, NULL, NULL);
159 g_signal_connect_after(p,
"button_release_event",
179 int idx = GPOINTER_TO_INT(data);
182 case GTK_RESPONSE_OK:
185 case GTK_RESPONSE_CANCEL:
186 case GTK_RESPONSE_DELETE_EVENT:
201 _(
"What should we call our new city?"), suggestname,
227 if (ev->button == 1 || ev->button == 3) {
232 (ev->state & GDK_SHIFT_MASK) != 0);
244 struct city *pcity = NULL;
245 struct tile *ptile = NULL;
259 switch (ev->button) {
264 if ((ev->state & GDK_SHIFT_MASK) && (ev->state & GDK_CONTROL_MASK)) {
266 }
else if (ev->state & GDK_CONTROL_MASK) {
269 }
else if (ptile && (ev->state & GDK_SHIFT_MASK)) {
272 }
else if (ptile && (ev->state & GDK_MOD1_MASK)) {
295 if (ev->state & GDK_CONTROL_MASK) {
307 if (ptile && (ev->state & GDK_MOD1_MASK)
308 && (ev->state & GDK_CONTROL_MASK)) {
310 }
else if ((ev->state & GDK_SHIFT_MASK) && (ev->state & GDK_MOD1_MASK)) {
313 }
else if ((ev->state & GDK_SHIFT_MASK) && (ev->state & GDK_CONTROL_MASK)
318 }
else if (ev->state & GDK_SHIFT_MASK
324 }
else if (ev->state & GDK_CONTROL_MASK) {
335 (ev->state & GDK_SHIFT_MASK) != 0);
358 GdkSeat *seat = gdk_display_get_default_seat(gtk_widget_get_display(
toplevel));
359 GdkDevice *pointer = gdk_seat_get_pointer(seat);
366 window = gdk_device_get_window_at_position(pointer, &x, &y);
368 if (window == gtk_widget_get_window(
map_canvas)) {
385 GdkModifierType mask;
386 GdkSeat *seat = gdk_display_get_default_seat(gtk_widget_get_display(
toplevel));
388 pointer = gdk_seat_get_pointer(seat);
393 window = gdk_device_get_window_at_position(pointer, &x, &y);
394 if (window && window == gtk_widget_get_window(
map_canvas)) {
395 gdk_device_get_state(pointer, window, NULL, &mask);
396 if (mask & GDK_BUTTON3_MASK) {
437 if (gtk_notebook_get_current_page(GTK_NOTEBOOK(
top_notebook))
477 if (ev->type != GDK_BUTTON_PRESS) {
bool can_client_issue_orders(void)
bool can_client_change_view(void)
enum known_type client_tile_get_known(const struct tile *ptile)
void do_map_click(struct tile *ptile, enum quickselect_type qtype)
struct unit_list * get_units_in_focus(void)
void request_center_focus_unit(void)
enum cursor_hover_state hover_state
void finish_city(struct tile *ptile, const char *name)
struct unit * find_visible_unit(struct tile *ptile)
void control_mouse_cursor(struct tile *ptile)
void cancel_city(struct tile *ptile)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
bool editor_is_active(void)
void inputline_make_chat_link(struct tile *ptile, bool unit)
gboolean handle_edit_mouse_button_release(GdkEventButton *ev)
gboolean handle_edit_mouse_button_press(GdkEventButton *ev)
gboolean handle_edit_mouse_move(GdkEventMotion *ev)
GtkWidget * turn_done_button
GtkWidget * overview_canvas
void update_turn_done_tooltip(void)
#define GUI_GTK_OPTION(optname)
gboolean butt_release_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data)
gboolean move_overviewcanvas(GtkWidget *w, GdkEventMotion *ev, gpointer data)
gboolean butt_down_overviewcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data)
void popup_newcity_dialog(struct unit *punit, const char *suggestname)
void center_on_unit(void)
void create_line_at_mouse_pos(void)
static gboolean popit_button_release(GtkWidget *w, GdkEventButton *event)
gboolean butt_down_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data)
gboolean move_mapcanvas(GtkWidget *w, GdkEventMotion *ev, gpointer data)
void set_turn_done_button_state(bool state)
gboolean leave_mapcanvas(GtkWidget *widget, GdkEventCrossing *event)
static void popupinfo_positioning_callback(GtkWidget *w, GtkAllocation *alloc, gpointer data)
static void popit(GdkEventButton *event, struct tile *ptile)
void popupinfo_popdown_callback(GtkWidget *w, gpointer data)
static void name_new_city_popup_callback(gpointer data, gint response, const char *input)
void update_rect_at_mouse_pos(void)
void update_unit_info_label(struct unit_list *punits)
void update_mouse_cursor(enum cursor_type new_cursor_type)
bool infra_placement_mode(void)
void infra_placement_set_tile(struct tile *ptile)
bool rally_set_tile(struct tile *ptile)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
struct tile * map_pos_to_tile(const struct civ_map *nmap, int map_x, int map_y)
void update_line(int canvas_x, int canvas_y)
void maybe_activate_keyboardless_goto(int canvas_x, int canvas_y)
void adjust_workers_button_pressed(int canvas_x, int canvas_y)
void release_goto_button(int canvas_x, int canvas_y)
bool tiles_hilited_cities
void action_button_pressed(int canvas_x, int canvas_y, enum quickselect_type qtype)
void wakeup_button_pressed(int canvas_x, int canvas_y)
void release_right_button(int canvas_x, int canvas_y, bool shift)
bool keyboardless_goto_button_down
void key_city_overlay(int canvas_x, int canvas_y)
void update_selection_rectangle(float canvas_x, float canvas_y)
void overview_update_line(int overview_x, int overview_y)
void anchor_selection_rectangle(int canvas_x, int canvas_y)
void cancel_tile_hiliting(void)
void clipboard_paste_production(struct city *pcity)
bool clipboard_copy_production(struct tile *ptile)
void toggle_tile_hilite(struct tile *ptile)
void mapdeco_set_crosshair(const struct tile *ptile, bool crosshair)
struct tile * canvas_pos_to_tile(float canvas_x, float canvas_y, float zoom)
void mapdeco_set_gotoroute(const struct unit *punit)
void mapdeco_clear_gotoroutes(void)
void center_tile_mapcanvas(const struct tile *ptile)
void mapdeco_clear_crosshairs(void)
bool tile_to_canvas_pos(float *canvas_x, float *canvas_y, float zoom, const struct tile *ptile)
void overview_to_map_pos(int *map_x, int *map_y, int overview_x, int overview_y)
#define CLIP(lower, current, upper)
const char * popup_info_text(struct tile *ptile)
struct city * tile_city(const struct tile *ptile)
int tileset_tile_height(const struct tileset *t)
int tileset_tile_width(const struct tileset *t)