Skip to content

Add a button to rotate the screen

Thomas Loimer requested to merge tloimer/gtk-vnc:rotate into master

A menu item is added that, on each press, would rotate the screen by an additional 90° clockwise. I used the the text "Rotate ↷", where the probably not shown glyph is ucs code point 21b7 - clockwise top semicircle arrow. Evince would use the text "Rotate ", with ucs code point 2935. The latter does not display on my system. In fact, I believe it is a bit of hubris, to use such a high code point in the menu of an application window. 21b7 is probably not much better - probably one should write "Rotate +90° clockwise".

The rotation code in vncdisplay.c is within the functions where transformations are demanded, depending on whether the value of priv->rotation is 0, 90, 180 or 270. Probably, one could set a function pointer priv->transform, which might make the code more maintainable, at the cost of extra function calls, and a larger struct priv. Also, the forward transformation from remote-desktop-space to widget-display-space is done twice, the inverse transformation once. Again, one could add an element cairo_matrix_t mtx to priv, instead of setting that on each call to the drawing and event handling functions.

The rotation element is a guint, unsigned variables are also used where "rotation" is compared. Not sure, whether it is best practice to use an unsigned integer here.

A further, welcome addition would be to be able to hide the menu bar. I believe, with gtk4 the menu should anyhow move into the header bar. Porting to gtk4 is probably quite an endeavour?

Merge request reports