From 6aaba1066fe89f324d4bae67497f4035fe997d5f Mon Sep 17 00:00:00 2001 From: Yuta Doi Date: Mon, 11 Dec 2017 11:38:01 +0900 Subject: Add APIs which can get information of display and area getDisplayInfo() can get the display information as follows: - width[pixel] - height[pixel] - width[mm] - height[mm] NOTE: It uses wl_output::geometry() for getting physical width[mm] and height[mm] of the display, but the value is different with measured value. value from wl_output::geometry(): width:320 height:520 measured value : width:193 height:343 getAreaInfo() can get the information of area drawn by the application as follows: - x-coordinate - y-coordinate - width - height The details are described in doc/ApplicationGuide.md. Change-Id: I41eec6251527862ef25d1b84cd37d736d3f9c8aa Signed-off-by: Yuta Doi --- doc/ApplicationGuide.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/ApplicationGuide.md b/doc/ApplicationGuide.md index 7888292..d66f20b 100644 --- a/doc/ApplicationGuide.md +++ b/doc/ApplicationGuide.md @@ -517,6 +517,10 @@ This is the public interface of the class `LibWindowmanager`. int activateSurface(json_object *object); int deactivateSurface(json_object *object); int endDraw(json_object *object); + int getDisplayInfo(json_object *object); + int getAreaInfo(json_object *in_obj, json_object *out_obj); + + int getAreaInfo(const char *label, json_object *out_obj); void set_event_handler(enum EventType et, handler_fun f); @@ -580,6 +584,56 @@ It is not crucial to make this call at every time a drawing is finished drawing in case of layout switch. The exact semantics are explained in the next [Events](#_events) Section. +### getDisplayInfo(json_object *object) + +**args: `{ }`** +This function gets the display information as follows: + - width[pixel] + - height[pixel] + - width[mm] + - height[mm] + +It outputs the display information for json_object in the argument as follows: + `{"width_pixel": int value of width[pixel], "height_pixel": int value of height[pixel], + "width_mm": int value of width[mm], "height_mm": int value of height[mm]}` + +It should be called after calling init(). +It should not be called in the event handler because it occurs hang-up. + +#### NOTE +It uses wl_output::geometry() for getting physical width[mm] and height[mm] of the display, +but the value is different with measured value. + + - value from wl_output::geometry(): width:320 height:520 + - measured value : width:193 height:343 + +### getAreaInfo(json_object *in_obj, json_object *out_obj) + +**args1: `{ 'kKeyDrawingName': 'application name' }`** +**args2: `{ }`** +This function gets the information of area drawn by the application as follows: + - x-coordinate + - y-coordinate + - width + - height + +It outputs the area information for json_object in the 2nd argument as follows: + `{"x": int value of x-coordinate, "y": int value of y-coordinate, + "width": int value of width, "height": int value of height}` + +It should be called after calling activateSurface(). +It should not be called in the event handler because it occurs hang-up. + +#### NOTE +The same information can given by SyncDraw event. + +### getAreaInfo(const char *label, json_object *out_obj) + +**args1: String of application name** +**args2: `{ }`** +This function is same with `getAreaInfo(json_object *in_obj, json_object *out_obj)`, +but only has difference of 1st argument. + ### set\_event\_handler(enum EventType et, handler_fun f) This method needs to be used to register event handlers for the WM @@ -705,11 +759,14 @@ contents - again, this is handled implicitly by the wayland protocol. that is *signal* the compositor that its surface contains new content. - `SyncDraw(json_object *object)` - args: { 'kKeyDrawingName': 'application name', 'kKeyDrawingArea': 'layout' } + args: { 'kKeyDrawingName': 'application name', 'kKeyDrawingArea': 'layout', + 'kKeyDrawingRect': { "x": int value of x-coordinate, "y": int value of y-coordinate, + "width": int value of width, "height": int value of height } } Signal applications, that the surface with name `kKeyDrawingArea` needs to redraw its content in the layout with name `kKeyDrawingArea` - this usually is sent when the surface geometry changed. + And the area position and size are included with name `kKeyDrawingRect`. - `FlushDraw(json_object *object)` args: { 'kKeyDrawingName': 'application name' } -- cgit 1.2.3-korg