Screen rotation and keys
Klaus Weidner
kweidner at pobox.com
Sun Jan 27 07:17:47 EST 2008
On Sun, Jan 27, 2008 at 03:08:34AM -0800, david at lang.hm wrote:
> Klaus Weidner wrote:
>> How about the following:
>>
>> - by default, the rotate key rotates both the screen and the rocker
>> switch, so that pressing the rocker towards the (logical) top of the
>> screen always generates an "Up" arrow keystroke. The game keys don't
>> rotate.
>>
>> - applications can choose to get notified of rotation events and the
>> new
>> orientation in case they want to add actions to the default ones, such
>> as optimizing the screen layout for the new orientation.
>>
>> - applications can disable auto-rotation, making the rotate button
>> available for the application as a normal input. The rocker switch
>> doesn't get auto-modified and stays under app control.
>>
>> I think it would be important to have something sane happen by default,
>> and that would let non-rotation-aware apps have basic functionality.
>
> I would agree with this proposal. if an application chooses to disable
> auto-rotation they should be able to re-map all 9 of the game keys. it
> would be nice to have this done in a way that would be able to be
> scripted
> (for use in the terminal window for example)
>
> note that the rotation could still take place when other applications are
> active, so the application still needs to be able to respond to resize
> events (which should be standard for apps that live in a GUI environment
> anyway, even if they are text apps that run in an xterm)
It's not just resizing - if a different application rotates the screen,
that happens via xrandr, and the X server rearranges its framebuffer
internally to match the orientation. All apps will be flipped if they
want to be or not, not just resized. It would have to tell the X server
to flip back if it needed a specific orientation.
So a non-rotating app would need to check for rotations and force a
specific orientation when it starts, and whenever it regains its status
as active app if the user had switched away.
> while I understand the desire to avoid modal operation and also to not
> have the e-book mode operate by moving a pointer around, I think that the
> ability to switch to a mode where you can toggle between the existing
> functions of the gamepad keys and a mode where the arrows move the mouse
> pointer and X and O mimic the mouse buttons (with matching lables) would
> be extremely useful for applications that have not been converted yet.
>
> in fact, how's this for an idea?
>
> in e-book mode (screen rotated and flat against the keyboard) the rotate
> button doesn't rotate the screen, instead it toggles between existing
> behavior and pointer mode. you could change the shape of the exit icon
> when in pointer mode to indicate what mode you are in.
I can see how this can be useful (I once did similar things to run X apps
that need 3 mouse buttons on a touchscren handheld), but the modality
combined with moving the pointer with cursor keys quickly gets
frustrating. I think it's probably better to use the e-book mode just for
applications that are designed to work with it - you can just use the
normal notebook mode for non-converted apps if necessary.
Also, you lose the function of the rotate button to rotate the screen,
and I think people expect that to work. I guess you could use something
like a long press as opposed to a short press, but that violates the
principle of least surprise.
-Klaus
-------------- next part --------------
diff --git a/shell/ev-view.c b/shell/ev-view.c
index b464c3f..3bfe7da 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -360,7 +360,7 @@ scroll_to_current_page (EvView *view, GtkOrientation orientation)
view_point.y + view->vadjustment->page_size);
} else {
gtk_adjustment_set_value (view->vadjustment,
- CLAMP (view_point.y,
+ CLAMP (view->vadjustment->value,
view->vadjustment->lower,
view->vadjustment->upper -
view->vadjustment->page_size));
@@ -372,7 +372,7 @@ scroll_to_current_page (EvView *view, GtkOrientation orientation)
view_point.x + view->hadjustment->page_size);
} else {
gtk_adjustment_set_value (view->hadjustment,
- CLAMP (view_point.x,
+ CLAMP (view->hadjustment->value,
view->hadjustment->lower,
view->hadjustment->upper -
view->hadjustment->page_size));
@@ -3996,6 +3996,8 @@ ev_view_class_init (EvViewClass *class)
binding_set = gtk_binding_set_by_class (class);
+ add_scroll_binding_keypad (binding_set, GDK_Page_Up, 0, EV_SCROLL_PAGE_BACKWARD, FALSE);
+ add_scroll_binding_keypad (binding_set, GDK_Page_Down, 0, EV_SCROLL_PAGE_FORWARD, FALSE);
add_scroll_binding_keypad (binding_set, GDK_Left, 0, EV_SCROLL_STEP_BACKWARD, TRUE);
add_scroll_binding_keypad (binding_set, GDK_Right, 0, EV_SCROLL_STEP_FORWARD, TRUE);
add_scroll_binding_keypad (binding_set, GDK_Left, GDK_MOD1_MASK, EV_SCROLL_STEP_DOWN, TRUE);
-------------- next part --------------
diff --git a/readactivity.py b/readactivity.py
index 956e3b0..99b9244 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -95,7 +95,7 @@ class ReadActivity(activity.Activity):
toolbox.add_toolbar(_('Read'), self._read_toolbar)
self._read_toolbar.show()
- self._view_toolbar = ViewToolbar(self._view)
+ self._view_toolbar = ViewToolbar(self._view, self)
self._view_toolbar.connect('needs-update-size',
self.__view_toolbar_needs_update_size_cb)
toolbox.add_toolbar(_('View'), self._view_toolbar)
diff --git a/readtoolbar.py b/readtoolbar.py
index 332e4fa..be475b2 100644
--- a/readtoolbar.py
+++ b/readtoolbar.py
@@ -258,9 +258,10 @@ class ViewToolbar(gtk.Toolbar):
([]))
}
- def __init__(self, evince_view):
+ def __init__(self, evince_view, activity):
gtk.Toolbar.__init__(self)
+ self._activity = activity
self._evince_view = evince_view
self._document = None
@@ -293,6 +294,16 @@ class ViewToolbar(gtk.Toolbar):
palette.menu.append(menu_item)
menu_item.show()
+ menu_item = MenuItem(_('Single pages'))
+ menu_item.connect('activate', self._continuous_false_menu_item_activate_cb)
+ palette.menu.append(menu_item)
+ menu_item.show()
+
+ menu_item = MenuItem(_('Continuous pages'))
+ menu_item.connect('activate', self._continuous_true_menu_item_activate_cb)
+ palette.menu.append(menu_item)
+ menu_item.show()
+
tool_item = gtk.ToolItem()
self.insert(tool_item, -1)
tool_item.show()
@@ -313,6 +324,14 @@ class ViewToolbar(gtk.Toolbar):
self.insert(tool_item_zoom_perc_label, -1)
tool_item_zoom_perc_label.show()
+ self._view_fullscreen = ToolButton('view-fullscreen')
+ self._view_fullscreen.set_tooltip(_('Fullscreen mode'))
+ self._view_fullscreen.connect('clicked', self._view_fullscreen_cb)
+ self.insert(self._view_fullscreen, -1)
+ self._view_fullscreen.show()
+
+ self._zoom_to_width.show()
+
self._view_notify_zoom_handler = self._evince_view.connect(
'notify::zoom', self._view_notify_zoom_cb)
@@ -364,3 +383,12 @@ class ViewToolbar(gtk.Toolbar):
self._evince_view.props.zoom = 1.0
self._update_zoom_buttons()
+ def _continuous_false_menu_item_activate_cb(self, menu_item):
+ self._evince_view.set_continuous(False)
+
+ def _continuous_true_menu_item_activate_cb(self, menu_item):
+ self._evince_view.set_continuous(True)
+
+ def _view_fullscreen_cb(self, button):
+ self._activity.fullscreen()
+
-------------- next part --------------
_______________________________________________
Devel mailing list
Devel at lists.laptop.org
http://lists.laptop.org/listinfo/devel
More information about the Devel
mailing list