Merge lp:~tigrangab/slingshot/rtl_fix into lp:~elementary-pantheon/slingshot/trunk
- rtl_fix
- Merge into trunk
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Cody Garver | ||||
Proposed branch: | lp:~tigrangab/slingshot/rtl_fix | ||||
Merge into: | lp:~elementary-pantheon/slingshot/trunk | ||||
Diff against target: |
239 lines (+76/-51) 1 file modified
src/SlingshotView.vala (+76/-51) |
||||
To merge this branch: | bzr merge lp:~tigrangab/slingshot/rtl_fix | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Gomes (community) | Needs Fixing | ||
Review via email: mp+184029@code.launchpad.net |
Commit message
Description of the change
Needs this granite branch to work correctly: https:/
Andrea Basso (voluntatefaber) wrote : | # |
Tigran Gabrielyan (tigrangab) wrote : | # |
Wasn't aware there were more issues. I'll install a RTL language to actually test it.
Tigran Gabrielyan (tigrangab) wrote : | # |
Can you check it now and make sure I didn't miss anything and it works correctly?
Andrea Basso (voluntatefaber) wrote : | # |
I'm currently not at home, so I unfortunately cannot test it.
Just looking at the code, though, are you sure keyboard shortcuts works fine, especially in turning pages?
Tigran Gabrielyan (tigrangab) wrote : | # |
No :) I was doing that at 2AM, I'm working on it.
Tigran Gabrielyan (tigrangab) wrote : | # |
Shouldn't the first page in RTL still be full?
https:/
Andrea Basso (voluntatefaber) wrote : | # |
I'd say that's definitely a bug. And also Slingshot position, I guess you
appear in top-left corner...
Tigran Gabrielyan (tigrangab) wrote : | # |
Please test this when you get a chance. If something doesn't work as expected, please let me know how it should work. Thanks.
Andrea Basso (voluntatefaber) wrote : | # |
I'll do that as soon as I get back :)
Il giorno 06/set/2013 08:59, "Tigran Gabrielyan" <email address hidden> ha
scritto:
> Please test this when you get a chance. If something doesn't work as
> expected, please let me know how it should work. Thanks.
> --
> https:/
> Your team elementary Pantheon team is requested to review the proposed
> merge of lp:~tigrangab/slingshot/rtl_fix into lp:slingshot.
>
David Gomes (davidgomes) wrote : | # |
I need someone to test this or teach me how to. Should I change my language to Hebrew or something?
Tigran Gabrielyan (tigrangab) wrote : | # |
I left a note on the PopOver merge request about it. Add setDefaultDirec
David Gomes (davidgomes) wrote : | # |
Remove diff line 236, 73. Add newline after diff line 49. I tested and it worked, good job.
David Gomes (davidgomes) wrote : | # |
This is DEPENDENT on a Granite bug fix which HAS NOT been released on Luna yet. So we can only merge this to stable PPA when Granite gets a push to the stable PPA with that bug fix.
Sergey "Shnatsel" Davidoff (shnatsel) wrote : | # |
Can we merge this now? At least as an Isis-only fix?
Unmerged revisions
- 381. By Tigran Gabrielyan
-
Fix RTL key navigation
- 380. By Tigran Gabrielyan
-
Fix keyboard and scroll navigation for RTL
- 379. By Tigran Gabrielyan
-
Show slingshot on right side of screen if language is RTL
Preview Diff
1 | === modified file 'src/SlingshotView.vala' | |||
2 | --- src/SlingshotView.vala 2013-09-04 19:08:08 +0000 | |||
3 | +++ src/SlingshotView.vala 2013-09-06 06:54:15 +0000 | |||
4 | @@ -61,6 +61,9 @@ | |||
5 | 61 | private int search_view_position = 0; | 61 | private int search_view_position = 0; |
6 | 62 | private Modality modality; | 62 | private Modality modality; |
7 | 63 | 63 | ||
8 | 64 | // Used for RTL support | ||
9 | 65 | private int direction = 1; | ||
10 | 66 | |||
11 | 64 | // Sizes | 67 | // Sizes |
12 | 65 | public int columns { | 68 | public int columns { |
13 | 66 | get { | 69 | get { |
14 | @@ -111,6 +114,10 @@ | |||
15 | 111 | setup_ui (); | 114 | setup_ui (); |
16 | 112 | connect_signals (); | 115 | connect_signals (); |
17 | 113 | 116 | ||
18 | 117 | if (get_default_direction () == Gtk.TextDirection.RTL) { | ||
19 | 118 | direction = -1; | ||
20 | 119 | } | ||
21 | 120 | |||
22 | 114 | debug ("Apps loaded"); | 121 | debug ("Apps loaded"); |
23 | 115 | 122 | ||
24 | 116 | } | 123 | } |
25 | @@ -281,17 +288,19 @@ | |||
26 | 281 | 288 | ||
27 | 282 | } | 289 | } |
28 | 283 | 290 | ||
31 | 284 | private void reposition (bool show=true) { | 291 | private void reposition (bool show = true) { |
30 | 285 | |||
32 | 286 | debug("Repositioning"); | 292 | debug("Repositioning"); |
34 | 287 | 293 | ||
35 | 294 | var direction = get_default_direction (); | ||
36 | 288 | Gdk.Rectangle monitor_dimensions, app_launcher_pos; | 295 | Gdk.Rectangle monitor_dimensions, app_launcher_pos; |
37 | 289 | screen.get_monitor_geometry (this.screen.get_primary_monitor(), out monitor_dimensions); | 296 | screen.get_monitor_geometry (this.screen.get_primary_monitor(), out monitor_dimensions); |
43 | 290 | app_launcher_pos = Gdk.Rectangle () { x = monitor_dimensions.x, | 297 | |
44 | 291 | y = monitor_dimensions.y, | 298 | app_launcher_pos = Gdk.Rectangle () { |
45 | 292 | width = 100, | 299 | x = (direction == Gtk.TextDirection.RTL) ? monitor_dimensions.width : monitor_dimensions.x, |
46 | 293 | height = 30 | 300 | y = monitor_dimensions.y, |
47 | 294 | }; | 301 | width = 100, |
48 | 302 | height = 30 | ||
49 | 303 | }; | ||
50 | 295 | move_to_rect (app_launcher_pos, show); | 304 | move_to_rect (app_launcher_pos, show); |
51 | 296 | } | 305 | } |
52 | 297 | 306 | ||
53 | @@ -391,15 +400,17 @@ | |||
54 | 391 | case "Left": | 400 | case "Left": |
55 | 392 | if (modality == Modality.NORMAL_VIEW) { | 401 | if (modality == Modality.NORMAL_VIEW) { |
56 | 393 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Left | 402 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Left |
58 | 394 | page_switcher.set_active (page_switcher.active - 1); | 403 | page_switcher.set_active (page_switcher.active - direction); |
59 | 395 | else | 404 | else |
61 | 396 | normal_move_focus (-1, 0); | 405 | normal_move_focus (-direction, 0); |
62 | 397 | } else if (modality == Modality.CATEGORY_VIEW) { | 406 | } else if (modality == Modality.CATEGORY_VIEW) { |
63 | 398 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Left | 407 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Left |
68 | 399 | category_view.switcher.set_active (category_view.switcher.active - 1); | 408 | category_view.switcher.set_active (category_view.switcher.active - direction); |
69 | 400 | else if (!searchbar.has_focus) {//the user has already selected an AppEntry | 409 | else if (searchbar.has_focus && direction == -1) // there's no AppEntry selected, the user is switching category |
70 | 401 | category_move_focus (-1, 0); | 410 | top_left_focus (); |
71 | 402 | } | 411 | else |
72 | 412 | category_move_focus (-direction, 0); | ||
73 | 413 | |||
74 | 403 | } else | 414 | } else |
75 | 404 | return base.key_press_event (event); | 415 | return base.key_press_event (event); |
76 | 405 | break; | 416 | break; |
77 | @@ -407,16 +418,16 @@ | |||
78 | 407 | case "Right": | 418 | case "Right": |
79 | 408 | if (modality == Modality.NORMAL_VIEW) { | 419 | if (modality == Modality.NORMAL_VIEW) { |
80 | 409 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Right | 420 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Right |
82 | 410 | page_switcher.set_active (page_switcher.active + 1); | 421 | page_switcher.set_active (page_switcher.active + direction); |
83 | 411 | else | 422 | else |
85 | 412 | normal_move_focus (+1, 0); | 423 | normal_move_focus (direction, 0); |
86 | 413 | } else if (modality == Modality.CATEGORY_VIEW) { | 424 | } else if (modality == Modality.CATEGORY_VIEW) { |
87 | 414 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Right | 425 | if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Right |
90 | 415 | category_view.switcher.set_active (category_view.switcher.active + 1); | 426 | category_view.switcher.set_active (category_view.switcher.active + direction); |
91 | 416 | else if (searchbar.has_focus) // there's no AppEntry selected, the user is switching category | 427 | else if (searchbar.has_focus && direction == 1) // there's no AppEntry selected, the user is switching category |
92 | 417 | top_left_focus (); | 428 | top_left_focus (); |
93 | 418 | else //the user has already selected an AppEntry | 429 | else //the user has already selected an AppEntry |
95 | 419 | category_move_focus (+1, 0); | 430 | category_move_focus (direction, 0); |
96 | 420 | } else { | 431 | } else { |
97 | 421 | return base.key_press_event (event); | 432 | return base.key_press_event (event); |
98 | 422 | } | 433 | } |
99 | @@ -463,7 +474,7 @@ | |||
100 | 463 | 474 | ||
101 | 464 | case "Page_Up": | 475 | case "Page_Up": |
102 | 465 | if (modality == Modality.NORMAL_VIEW) { | 476 | if (modality == Modality.NORMAL_VIEW) { |
104 | 466 | page_switcher.set_active (page_switcher.active - 1); | 477 | page_switcher.set_active (page_switcher.active - direction); |
105 | 467 | if (page_switcher.active != 0) // we don't wanna lose focus if we don't actually change page | 478 | if (page_switcher.active != 0) // we don't wanna lose focus if we don't actually change page |
106 | 468 | searchbar.grab_focus (); // this is because otherwise focus isn't the current page | 479 | searchbar.grab_focus (); // this is because otherwise focus isn't the current page |
107 | 469 | } else if (modality == Modality.CATEGORY_VIEW) { | 480 | } else if (modality == Modality.CATEGORY_VIEW) { |
108 | @@ -474,7 +485,7 @@ | |||
109 | 474 | 485 | ||
110 | 475 | case "Page_Down": | 486 | case "Page_Down": |
111 | 476 | if (modality == Modality.NORMAL_VIEW) { | 487 | if (modality == Modality.NORMAL_VIEW) { |
113 | 477 | page_switcher.set_active (page_switcher.active + 1); | 488 | page_switcher.set_active (page_switcher.active + direction); |
114 | 478 | if (page_switcher.active != grid_view.get_n_pages () - 1) // we don't wanna lose focus if we don't actually change page | 489 | if (page_switcher.active != grid_view.get_n_pages () - 1) // we don't wanna lose focus if we don't actually change page |
115 | 479 | searchbar.grab_focus (); //this is because otherwise focus isn't the current page | 490 | searchbar.grab_focus (); //this is because otherwise focus isn't the current page |
116 | 480 | } else if (modality == Modality.CATEGORY_VIEW) { | 491 | } else if (modality == Modality.CATEGORY_VIEW) { |
117 | @@ -542,32 +553,33 @@ | |||
118 | 542 | 553 | ||
119 | 543 | } | 554 | } |
120 | 544 | 555 | ||
121 | 556 | private void scroll_page (int direction) { | ||
122 | 557 | if (modality == Modality.NORMAL_VIEW) { | ||
123 | 558 | page_switcher.set_active (page_switcher.active + direction); | ||
124 | 559 | } else if (modality == Modality.SEARCH_VIEW) { | ||
125 | 560 | if (direction == this.direction) { | ||
126 | 561 | search_view_up (); | ||
127 | 562 | } else { | ||
128 | 563 | search_view_down (); | ||
129 | 564 | } | ||
130 | 565 | } else { | ||
131 | 566 | category_view.switcher.set_active (category_view.switcher.active + direction); | ||
132 | 567 | } | ||
133 | 568 | } | ||
134 | 569 | |||
135 | 545 | public override bool scroll_event (EventScroll event) { | 570 | public override bool scroll_event (EventScroll event) { |
136 | 546 | |||
137 | 547 | switch (event.direction.to_string ()) { | 571 | switch (event.direction.to_string ()) { |
138 | 548 | case "GDK_SCROLL_UP": | 572 | case "GDK_SCROLL_UP": |
139 | 549 | case "GDK_SCROLL_LEFT": | 573 | case "GDK_SCROLL_LEFT": |
146 | 550 | if (modality == Modality.NORMAL_VIEW) | 574 | scroll_page (-direction); |
141 | 551 | page_switcher.set_active (page_switcher.active - 1); | ||
142 | 552 | else if (modality == Modality.SEARCH_VIEW) | ||
143 | 553 | search_view_up (); | ||
144 | 554 | else | ||
145 | 555 | category_view.switcher.set_active (category_view.switcher.active - 1); | ||
147 | 556 | break; | 575 | break; |
148 | 557 | case "GDK_SCROLL_DOWN": | 576 | case "GDK_SCROLL_DOWN": |
149 | 558 | case "GDK_SCROLL_RIGHT": | 577 | case "GDK_SCROLL_RIGHT": |
156 | 559 | if (modality == Modality.NORMAL_VIEW) | 578 | scroll_page (direction); |
151 | 560 | page_switcher.set_active (page_switcher.active + 1); | ||
152 | 561 | else if (modality == Modality.SEARCH_VIEW) | ||
153 | 562 | search_view_down (); | ||
154 | 563 | else | ||
155 | 564 | category_view.switcher.set_active (category_view.switcher.active + 1); | ||
157 | 565 | break; | 579 | break; |
158 | 566 | |||
159 | 567 | } | 580 | } |
160 | 568 | 581 | ||
161 | 569 | return false; | 582 | return false; |
162 | 570 | |||
163 | 571 | } | 583 | } |
164 | 572 | 584 | ||
165 | 573 | public void show_slingshot () { | 585 | public void show_slingshot () { |
166 | @@ -590,34 +602,40 @@ | |||
167 | 590 | Wnck.Screen.get_default ().force_update (); | 602 | Wnck.Screen.get_default ().force_update (); |
168 | 591 | if (w != null) | 603 | if (w != null) |
169 | 592 | w.activate (Gdk.x11_get_server_time (this.get_window ())); | 604 | w.activate (Gdk.x11_get_server_time (this.get_window ())); |
171 | 593 | } | 605 | } |
172 | 594 | 606 | ||
173 | 595 | private void move_page (int step) { | 607 | private void move_page (int step) { |
174 | 596 | |||
175 | 597 | debug ("Moving: step = " + step.to_string ()); | 608 | debug ("Moving: step = " + step.to_string ()); |
177 | 598 | 609 | ||
178 | 599 | if (step == 0) | 610 | if (step == 0) |
179 | 600 | return; | 611 | return; |
185 | 601 | if (step < 0 && current_position >= 0) //Left border | 612 | |
186 | 602 | return; | 613 | int max_position = (grid_view.get_n_pages () - 1) * grid_view.get_page_columns () * 130; |
187 | 603 | if (step > 0 && (-current_position) >= ((grid_view.get_n_pages () - 1) * grid_view.get_page_columns () * 130)) //Right border | 614 | |
188 | 604 | return; | 615 | if (step < 0) { |
189 | 605 | 616 | if ((direction == 1 && current_position >= 0) || (direction == -1 && current_position <= -max_position)) { | |
190 | 617 | return; | ||
191 | 618 | } | ||
192 | 619 | } else { | ||
193 | 620 | if ((direction == 1 && current_position <= -max_position) || (direction == -1 && current_position >= 0)) { | ||
194 | 621 | return; | ||
195 | 622 | } | ||
196 | 623 | } | ||
197 | 624 | |||
198 | 606 | int count = 0; | 625 | int count = 0; |
201 | 607 | int increment = -step*130*columns/10; | 626 | int increment = -step * 130 * columns / 10 * direction; |
200 | 608 | Timeout.add (30/columns, () => { | ||
202 | 609 | 627 | ||
203 | 628 | Timeout.add (30 / columns, () => { | ||
204 | 610 | if (count >= 10) { | 629 | if (count >= 10) { |
206 | 611 | current_position += -step*130*columns - 10*increment; //We adjust to end of the page | 630 | current_position += -step * 130 * columns - 10 * increment * direction; //We adjust to end of the page |
207 | 612 | view_manager.move (grid_view, current_position, 0); | 631 | view_manager.move (grid_view, current_position, 0); |
208 | 613 | return false; | 632 | return false; |
209 | 614 | } | 633 | } |
211 | 615 | 634 | ||
212 | 616 | current_position += increment; | 635 | current_position += increment; |
213 | 617 | view_manager.move (grid_view, current_position, 0); | 636 | view_manager.move (grid_view, current_position, 0); |
214 | 618 | count++; | 637 | count++; |
215 | 619 | return true; | 638 | return true; |
216 | 620 | |||
217 | 621 | }, Priority.DEFAULT_IDLE); | 639 | }, Priority.DEFAULT_IDLE); |
218 | 622 | } | 640 | } |
219 | 623 | 641 | ||
220 | @@ -744,10 +762,17 @@ | |||
221 | 744 | grid_view.append (app_entry); | 762 | grid_view.append (app_entry); |
222 | 745 | app_entry.show_all (); | 763 | app_entry.show_all (); |
223 | 746 | } | 764 | } |
226 | 747 | 765 | ||
225 | 748 | view_manager.move (grid_view, 0, 0); | ||
227 | 749 | current_position = 0; | 766 | current_position = 0; |
228 | 750 | 767 | ||
229 | 768 | if (get_default_direction () == Gtk.TextDirection.RTL) { | ||
230 | 769 | int width; | ||
231 | 770 | view_manager.get_size_request (out width, null); | ||
232 | 771 | current_position = (grid_view.get_n_pages () - 1) * width * -1; | ||
233 | 772 | } | ||
234 | 773 | |||
235 | 774 | view_manager.move (grid_view, current_position, 0); | ||
236 | 775 | |||
237 | 751 | } | 776 | } |
238 | 752 | 777 | ||
239 | 753 | private void read_settings (bool first_start = false, bool check_columns = true, bool check_rows = true) { | 778 | private void read_settings (bool first_start = false, bool check_columns = true, bool check_rows = true) { |
I'm afraid that's really not enoguh, RTL goes way deeper than that, whereas your patch could solve the positioning problem, things like page-scrolling and keyboard shortcuts are still hardcoded as in a LTR prospective.