static PyObject* python_set_mapview_origin(PyObject* self, PyObject* args) { int arg_gui_x0; int arg_gui_y0; if(PyArg_ParseTuple(args, "ii", &arg_gui_x0, &arg_gui_y0) == 0) return NULL; set_mapview_origin(arg_gui_x0, arg_gui_y0); return Py_BuildValue("i", 0); }
JNIEXPORT jboolean JNICALL Java_net_hackcasual_freeciv_NativeHarness_touchEvent (JNIEnv *je, jobject o, jint x, jint y, jint type) { struct timeval tvs, tve; int nif = 0; static int oldx = -1; static int oldy = -1; lastTouchX = x; lastTouchY = y; int deltax; int deltay; static bool cancelUp; struct tile *plasttile; switch (type) { case 0: { cancelUp = FALSE; oldx = x; oldy = y; plasttile = canvas_pos_to_tile(x,y); break; } case 1: { if (!cancelUp && abs(x - oldx) < 10 && abs(y - oldy) < 10) { can_slide = FALSE; LOGI("ABP Lock"); civ_lock(); action_button_pressed(x,y,SELECT_POPUP); can_slide = TRUE; flush_dirty(); struct tile *ptile = canvas_pos_to_tile(x,y); civ_unlock(); return (ptile && ptile->units)?unit_list_size(ptile->units):0; } else if (!cancelUp) { LOGI("Recenter Lock"); civ_lock(); can_slide = FALSE; recenter_button_pressed(x, y); can_slide = TRUE; flush_dirty(); civ_unlock(); } break; } case 2: { /*hover_state = HOVER_GOTO; control_mouse_cursor(canvas_pos_to_tile(x,y)); update_line(x,y); break;*/ if (cancelUp || abs(x - oldx) > 10 || abs(y - oldy) > 10) { cancelUp = TRUE; LOGI("Slide Lock"); civ_lock(); can_slide = FALSE; deltax = oldx - x; deltay = oldy - y; set_mapview_origin(mapview.gui_x0 + deltax, mapview.gui_y0 + deltay); flush_dirty(); civ_unlock(); oldx = x; oldy = y; can_slide = TRUE; } break; } case 3: { cancelUp = TRUE; break; } } return 0; }