Skip to content

Commit

Permalink
update for the latest core changes
Browse files Browse the repository at this point in the history
  • Loading branch information
eyelash committed Apr 13, 2018
1 parent 497b276 commit 16a00f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build
build
9 changes: 0 additions & 9 deletions src/CoreConnection.vala
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,6 @@ class CoreConnection {
send_edit_array(view_id, "scroll", params);
}

public void send_click(string view_id, int64 line, int64 column, int64 modifiers, int64 click_count) {
var params = new Json.Array();
params.add_int_element(line);
params.add_int_element(column);
params.add_int_element(modifiers);
params.add_int_element(click_count);
send_edit_array(view_id, "click", params);
}

public void send_drag(string view_id, int64 line, int64 column, int64 modifiers) {
var params = new Json.Array();
params.add_int_element(line);
Expand Down
16 changes: 10 additions & 6 deletions src/EditView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,33 @@ class EditView: Gtk.DrawingArea, Gtk.Scrollable {
}
int64 line, column;
convert_xy(event.x, event.y, out line, out column);
bool modify_selection = (event.state & get_modifier_mask(Gdk.ModifierIntent.MODIFY_SELECTION)) != 0;
bool extend_selection = (event.state & get_modifier_mask(Gdk.ModifierIntent.EXTEND_SELECTION)) != 0;
switch (event.type) {
case Gdk.EventType.BUTTON_PRESS:
if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
if (modify_selection) {
core_connection.send_gesture(view_id, line, column, "toggle_sel");
} else if (extend_selection) {
core_connection.send_gesture(view_id, line, column, "range_select");
} else {
core_connection.send_click(view_id, line, column, 0, 1);
core_connection.send_gesture(view_id, line, column, "point_select");
if (event.button == Gdk.BUTTON_MIDDLE) {
paste_primary();
}
}
break;
case Gdk.EventType.2BUTTON_PRESS:
if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
if (modify_selection) {
core_connection.send_gesture(view_id, line, column, "multi_word_select");
} else {
core_connection.send_click(view_id, line, column, 0, 2);
core_connection.send_gesture(view_id, line, column, "word_select");
}
break;
case Gdk.EventType.3BUTTON_PRESS:
if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
if (modify_selection) {
core_connection.send_gesture(view_id, line, column, "multi_line_select");
} else {
core_connection.send_click(view_id, line, column, 0, 3);
core_connection.send_gesture(view_id, line, column, "line_select");
}
break;
}
Expand Down

0 comments on commit 16a00f6

Please sign in to comment.