genode/repos/os/src/app/pointer
Norman Feske eba9c15746 Follow practices suggested by "Effective C++"
The patch adjust the code of the base, base-<kernel>, and os repository.
To adapt existing components to fix violations of the best practices
suggested by "Effective C++" as reported by the -Weffc++ compiler
argument. The changes follow the patterns outlined below:

* A class with virtual functions can no longer publicly inherit base
  classed without a vtable. The inherited object may either be moved
  to a member variable, or inherited privately. The latter would be
  used for classes that inherit 'List::Element' or 'Avl_node'. In order
  to enable the 'List' and 'Avl_tree' to access the meta data, the
  'List' must become a friend.

* Instead of adding a virtual destructor to abstract base classes,
  we inherit the new 'Interface' class, which contains a virtual
  destructor. This way, single-line abstract base classes can stay
  as compact as they are now. The 'Interface' utility resides in
  base/include/util/interface.h.

* With the new warnings enabled, all member variables must be explicitly
  initialized. Basic types may be initialized with '='. All other types
  are initialized with braces '{ ... }' or as class initializers. If
  basic types and non-basic types appear in a row, it is nice to only
  use the brace syntax (also for basic types) and align the braces.

* If a class contains pointers as members, it must now also provide a
  copy constructor and assignment operator. In the most cases, one
  would make them private, effectively disallowing the objects to be
  copied. Unfortunately, this warning cannot be fixed be inheriting
  our existing 'Noncopyable' class (the compiler fails to detect that
  the inheriting class cannot be copied and still gives the error).
  For now, we have to manually add declarations for both the copy
  constructor and assignment operator as private class members. Those
  declarations should be prepended with a comment like this:

        /*
         * Noncopyable
         */
        Thread(Thread const &);
        Thread &operator = (Thread const &);

  In the future, we should revisit these places and try to replace
  the pointers with references. In the presence of at least one
  reference member, the compiler would no longer implicitly generate
  a copy constructor. So we could remove the manual declaration.

Issue #465
2018-01-17 12:14:35 +01:00
..
big_mouse.h Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
main.cc Follow practices suggested by "Effective C++" 2018-01-17 12:14:35 +01:00
README pointer: strip the last label element when matching labels 2017-11-30 11:23:22 +01:00
rom_registry.h Follow practices suggested by "Effective C++" 2018-01-17 12:14:35 +01:00
target.mk nitpicker: Layers and client-side mouse cursor 2014-08-11 15:55:33 +02:00
util.h pointer: custom pointer shape support 2017-11-30 11:23:22 +01:00

Pointer for Nitpicker with optional hover-sensitive shape support

Per default the standard "big mouse" pointer is rendered on screen.

Additionally, 'pointer' supports to render "pointer shapes" when hovering
Nitpicker sessions for which a shape was reported. This feature must be
enabled with the '<config shapes="yes"/>' option. When enabled, the
'pointer' component announces a 'Report' service for custom pointer shapes
and requests ROM sessions for Nitpicker's 'hover' and 'xray' reports. The
mapping between hovered Nitpicker sessions and applications can be achieved
with report session label rewriting:

! <start name="shape-arrow">
! 	<binary name="test-pointer"/>
! 	<resource name="RAM" quantum="2M"/>
! 	<config shape="arrow"/>
! 	<route>
! 		<service name="PD">     <parent/> </service>
! 		<service name="ROM">    <parent/> </service>
! 		<service name="CPU">    <parent/> </service>
! 		<service name="LOG">    <parent/> </service>
! 		<service name="Report" label="shape">
! 			<child name="pointer" label="test-label-arrow -> shape"/>
! 		</service>
! 	</route>
! </start>

In the example above, which is from 'pointer.run', the 'shape-arrow' component
reports an arrow shape with the label "shape". By rewriting the label of the
report, the shape will be drawn for the 'test-label-arrow' component when
its Nitpicker view is hovered.

Technically, the 'pointer' component compares the hovered label, which is
'test-label-arrow -> testnit' in this case, with the shape report label after
stripping the last element of each label, so the remaining label prefix
'test-label-arrow' is the actual match criteria.

When configured with '<config shapes="yes" verbose="yes"/>', the 'pointer'
component prints the labels of hovered Nitpicker sessions and received shape
reports to the 'LOG' service.

The most common use cases for pointer shapes are VirtualBox, which reports
the guest-pointer shapes if Guest Additions are installed, and Qt applications.