haiku/headers/private/app/ServerProtocol.h

364 lines
7.3 KiB
C
Raw Normal View History

/*
* Copyright 2001-2015, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Jérôme Duval, jerome.duval@free.fr
* Axel Dörfler, axeld@pinc-software.de
* Andrej Spielmann, <andrej.spielmann@seh.ox.ac.uk>
app_server: add new BView layers API * Add new methods BView::BeginLayer(uint8 opacity) BView::EndLayer() * All drawing between begin and end of a layer is redirected onto an intermediate bitmap. When ending the layer, this bitmap is composited onto the view with the opacity given when the layer was started. * Layers can be nested arbitrarily and will be blended onto each other in order. There can also be any arbitrary interleaving of layer begin/end and drawing operations. * Internally, drawing commands are redirected into a BPicture between BeginLayer and EndLayer (but client code need not know or care about this). Client code can also start/end other BPictures while inside a layer. * Uses the PictureBoundingBoxPlayer to determine the size of the layer bitmap before allocating and drawing into it, so it does not allocate more memory than necessary and -- more importantly -- it will not alpha-composite more pixels than necessary. * Drawing mode is always set to B_OP_ALPHA, blend mode to (B_PIXEL_ALPHA, B_ALPHA_COMPOSITE) while inside layers. This is necessary for (a) correct compositing output and (b) for redirection of drawing into the intermediate bitmap, which uses the renderer_region offset (in B_OP_COPY, the Painter does not use the AGG renderer methods, it directly accesses the pixel data. This would access out-of-bounds without the offset, so B_OP_COPY cannot be allowed.) To ensure these modes aren't changed, BView::SetDrawingMode() and BView::SetBlendingMode() are ignored while inside a layer. * The main motivation behind this new API is WebKit, which internally expects such a layers functionality to be present. A performant and reusable implementation of this functionality can only be done server-side in app_server.
2015-07-25 16:44:23 +03:00
* Julian Harnath, <julian.harnath@rwth-aachen.de>
*/
#ifndef APP_SERVER_PROTOCOL_H
#define APP_SERVER_PROTOCOL_H
#include <SupportDefs.h>
#if TEST_MODE
# define SERVER_INPUT_PORT "haiku-test:input port"
#endif
#define AS_PROTOCOL_VERSION 1
#define AS_REQUEST_COLOR_KEY 0x00010000
// additional option for AS_VIEW_SET_VIEW_BITMAP
enum {
// NOTE: all defines have to start with "AS_" to let the "code_to_name"
// utility work correctly
AS_GET_DESKTOP,
AS_REGISTER_INPUT_SERVER = 1,
AS_EVENT_STREAM_CLOSED,
// Notification of event stream closing to restart input_server
// Desktop definitions (through the ServerApp, though)
AS_GET_WINDOW_LIST,
AS_GET_WINDOW_INFO,
AS_MINIMIZE_TEAM,
AS_BRING_TEAM_TO_FRONT,
AS_WINDOW_ACTION,
AS_GET_APPLICATION_ORDER,
AS_GET_WINDOW_ORDER,
// Application definitions
AS_CREATE_APP,
AS_DELETE_APP,
AS_QUIT_APP,
AS_ACTIVATE_APP,
AS_APP_CRASHED,
AS_CREATE_WINDOW,
AS_CREATE_OFFSCREEN_WINDOW,
AS_DELETE_WINDOW,
AS_CREATE_BITMAP,
AS_DELETE_BITMAP,
AS_GET_BITMAP_OVERLAY_RESTRICTIONS,
AS_GET_BITMAP_SUPPORT_FLAGS,
AS_RECONNECT_BITMAP,
// Cursor commands
AS_SET_CURSOR,
AS_SET_VIEW_CURSOR,
AS_SHOW_CURSOR,
AS_HIDE_CURSOR,
AS_OBSCURE_CURSOR,
AS_QUERY_CURSOR_HIDDEN,
AS_CREATE_CURSOR,
AS_REFERENCE_CURSOR,
AS_DELETE_CURSOR,
AS_BEGIN_RECT_TRACKING,
AS_END_RECT_TRACKING,
AS_GET_CURSOR_POSITION,
AS_GET_CURSOR_BITMAP,
// Window definitions
AS_SHOW_OR_HIDE_WINDOW,
AS_INTERNAL_HIDE_WINDOW,
AS_MINIMIZE_WINDOW,
AS_QUIT_WINDOW,
AS_SEND_BEHIND,
AS_SET_LOOK,
AS_SET_FEEL,
AS_SET_FLAGS,
AS_DISABLE_UPDATES,
AS_ENABLE_UPDATES,
AS_BEGIN_UPDATE,
AS_END_UPDATE,
AS_NEEDS_UPDATE,
AS_SET_WINDOW_TITLE,
AS_ADD_TO_SUBSET,
AS_REMOVE_FROM_SUBSET,
AS_SET_ALIGNMENT,
AS_GET_ALIGNMENT,
AS_GET_WORKSPACES,
AS_SET_WORKSPACES,
AS_WINDOW_RESIZE,
AS_WINDOW_MOVE,
AS_SET_SIZE_LIMITS,
AS_ACTIVATE_WINDOW,
AS_IS_FRONT_WINDOW,
// BPicture definitions
AS_CREATE_PICTURE,
AS_DELETE_PICTURE,
AS_CLONE_PICTURE,
AS_DOWNLOAD_PICTURE,
// Font-related server communications
AS_SET_SYSTEM_FONT,
AS_GET_SYSTEM_FONTS,
AS_GET_SYSTEM_DEFAULT_FONT,
AS_SYSTEM_FONT_CHANGED,
AS_GET_FONT_LIST_REVISION,
AS_GET_FAMILY_AND_STYLES,
AS_GET_FAMILY_AND_STYLE,
AS_GET_FAMILY_AND_STYLE_IDS,
AS_GET_FONT_BOUNDING_BOX,
AS_GET_TUNED_COUNT,
AS_GET_TUNED_INFO,
AS_GET_FONT_HEIGHT,
AS_GET_FONT_FILE_FORMAT,
AS_GET_EXTRA_FONT_FLAGS,
AS_GET_STRING_WIDTHS,
AS_GET_EDGES,
AS_GET_ESCAPEMENTS,
AS_GET_ESCAPEMENTS_AS_FLOATS,
AS_GET_BOUNDINGBOXES_CHARS,
AS_GET_BOUNDINGBOXES_STRING,
AS_GET_BOUNDINGBOXES_STRINGS,
AS_GET_HAS_GLYPHS,
AS_GET_GLYPH_SHAPES,
AS_GET_TRUNCATED_STRINGS,
// Screen methods
AS_VALID_SCREEN_ID,
AS_GET_NEXT_SCREEN_ID,
AS_SCREEN_GET_MODE,
AS_SCREEN_SET_MODE,
AS_PROPOSE_MODE,
AS_GET_MODE_LIST,
AS_GET_SCREEN_FRAME,
AS_GET_PIXEL_CLOCK_LIMITS,
AS_GET_TIMING_CONSTRAINTS,
AS_SCREEN_GET_COLORMAP,
AS_GET_DESKTOP_COLOR,
AS_SET_DESKTOP_COLOR,
AS_GET_SCREEN_ID_FROM_WINDOW,
AS_READ_BITMAP,
AS_GET_RETRACE_SEMAPHORE,
AS_GET_ACCELERANT_INFO,
AS_GET_MONITOR_INFO,
AS_GET_FRAME_BUFFER_CONFIG,
AS_SET_DPMS,
AS_GET_DPMS_STATE,
AS_GET_DPMS_CAPABILITIES,
// Misc stuff
AS_GET_ACCELERANT_PATH,
AS_GET_DRIVER_PATH,
// Global function call defs
AS_SET_UI_COLORS,
AS_SET_UI_COLOR,
AS_SET_DECORATOR,
AS_GET_DECORATOR,
AS_R5_SET_DECORATOR,
AS_COUNT_DECORATORS,
AS_GET_DECORATOR_NAME,
AS_COUNT_WORKSPACES,
AS_CURRENT_WORKSPACE,
AS_ACTIVATE_WORKSPACE,
AS_SET_WORKSPACE_LAYOUT,
AS_GET_WORKSPACE_LAYOUT,
AS_GET_SCROLLBAR_INFO,
AS_SET_SCROLLBAR_INFO,
AS_GET_MENU_INFO,
AS_SET_MENU_INFO,
AS_IDLE_TIME,
AS_SET_MOUSE_MODE,
AS_GET_MOUSE_MODE,
AS_SET_FOCUS_FOLLOWS_MOUSE_MODE,
AS_GET_FOCUS_FOLLOWS_MOUSE_MODE,
AS_SET_ACCEPT_FIRST_CLICK,
AS_GET_ACCEPT_FIRST_CLICK,
Next big step in the event handling: * RootLayer's mouse event processing is now at its minimum - the EventDispatcher handles them now. As a result, a window will now get only one message per event. * RootLayer adds "_view_token" to mouse moved messages that specify the view currently under the cursor. * There is now a mouse event layer in RootLayer that gets preferred when it's set - this is now used for the window moving instead of the previous mechanism. * changed the previous DistributeMessage() to an UnpackMessage() method following Adi's suggestion. * caveat: some things might be functionally broken in RootLayer now because of removing the mouse notification stuff. * "be:transit" handling is now done completely client side by BWindow::_SanitizeMessage(() (similar to what the input_server does). This should also make the mechanism pretty robust, since every B_MOUSE_MOVED message can now trigger the view transit (in case a message is lost). B_WINDOW_ACTIVATED messages should be generated client side as well. * renamed AS_LAYER_GET_MOUSE_COORDS to AS_GET_MOUSE as it's not a layer specific command, and also gets the mouse buttons. * B_MOUSE_* messages from the up server now contain only a "screen_where" field; "where" (in window's coordinates) and "be:view_where" are added in BMessage::_SanitizeMessage(). * messages that don't have a valid target in the looper are now dropped instead of being sent to the looper - this should be done in BLooper as well, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15087 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-23 18:17:58 +03:00
AS_GET_MOUSE,
AS_SET_DECORATOR_SETTINGS,
AS_GET_DECORATOR_SETTINGS,
AS_GET_SHOW_ALL_DRAGGERS,
AS_SET_SHOW_ALL_DRAGGERS,
Patch by Andrej Spielmann (GSoC): * Simplified the subpixel related methods for the AGG "pixel format" template interface, the ones for the solid cover simply pass through the existing methods, so only one subpixel blending function is left which does the actual work (this removes a lot of the previously added code) * Implemented a new rasterizer based on the original AGG rasterizer which implements subpixel anti-aliasing for any generic AGG vector pipelines. It is now optionally used in Painter and AGGTextRenderer (for vector fonts, ie rotated, sheared or big enough fonts) depending on the global subpixel setting. * Put all subpixel variables into the new GlobalSubpixelSettings.h|cpp * Simplified DesktopSettings related classes a bit and renamed previous FontSubpixelAntialiasing to just SubpixelAntialiasing. * The private libbe functions for subpixel related settings moved from Font.cpp to InterfaceDefs.cpp where other such functions live. They are not related to fonts only anymore. * Removed the subpixel related settings again from the Fonts preflet and added them to the Appearance preflet instead. All of the above implements subpixel anti-aliasing on a global scale, which to my knowledge no other OS is doing at the moment. Any vector rendering can optionally use subpixel anti-aliasing in Haiku now. The bitmap cached fonts are still affected by the Freetype complile time #define to enable the patented subpixel rasterization (three times wide glyphs). Vector fonts and shapes are not affected though at the moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26755 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 17:40:41 +04:00
// Subpixel antialiasing & hinting
AS_SET_SUBPIXEL_ANTIALIASING,
AS_GET_SUBPIXEL_ANTIALIASING,
AS_SET_HINTING,
AS_GET_HINTING,
Patch by Andrej Spielmann (GSoC): * Simplified the subpixel related methods for the AGG "pixel format" template interface, the ones for the solid cover simply pass through the existing methods, so only one subpixel blending function is left which does the actual work (this removes a lot of the previously added code) * Implemented a new rasterizer based on the original AGG rasterizer which implements subpixel anti-aliasing for any generic AGG vector pipelines. It is now optionally used in Painter and AGGTextRenderer (for vector fonts, ie rotated, sheared or big enough fonts) depending on the global subpixel setting. * Put all subpixel variables into the new GlobalSubpixelSettings.h|cpp * Simplified DesktopSettings related classes a bit and renamed previous FontSubpixelAntialiasing to just SubpixelAntialiasing. * The private libbe functions for subpixel related settings moved from Font.cpp to InterfaceDefs.cpp where other such functions live. They are not related to fonts only anymore. * Removed the subpixel related settings again from the Fonts preflet and added them to the Appearance preflet instead. All of the above implements subpixel anti-aliasing on a global scale, which to my knowledge no other OS is doing at the moment. Any vector rendering can optionally use subpixel anti-aliasing in Haiku now. The bitmap cached fonts are still affected by the Freetype complile time #define to enable the patented subpixel rasterization (three times wide glyphs). Vector fonts and shapes are not affected though at the moment. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26755 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 17:40:41 +04:00
AS_SET_SUBPIXEL_AVERAGE_WEIGHT,
AS_GET_SUBPIXEL_AVERAGE_WEIGHT,
AS_SET_SUBPIXEL_ORDERING,
AS_GET_SUBPIXEL_ORDERING,
// Graphics calls
AS_SET_HIGH_COLOR,
AS_SET_LOW_COLOR,
AS_SET_VIEW_COLOR,
AS_STROKE_ARC,
AS_STROKE_BEZIER,
AS_STROKE_ELLIPSE,
AS_STROKE_LINE,
AS_STROKE_LINEARRAY,
AS_STROKE_POLYGON,
AS_STROKE_RECT,
AS_STROKE_ROUNDRECT,
AS_STROKE_SHAPE,
AS_STROKE_TRIANGLE,
AS_FILL_ARC,
AS_FILL_ARC_GRADIENT,
AS_FILL_BEZIER,
AS_FILL_BEZIER_GRADIENT,
AS_FILL_ELLIPSE,
AS_FILL_ELLIPSE_GRADIENT,
AS_FILL_POLYGON,
AS_FILL_POLYGON_GRADIENT,
AS_FILL_RECT,
AS_FILL_RECT_GRADIENT,
AS_FILL_REGION,
AS_FILL_REGION_GRADIENT,
AS_FILL_ROUNDRECT,
AS_FILL_ROUNDRECT_GRADIENT,
AS_FILL_SHAPE,
AS_FILL_SHAPE_GRADIENT,
AS_FILL_TRIANGLE,
AS_FILL_TRIANGLE_GRADIENT,
AS_DRAW_STRING,
AS_DRAW_STRING_WITH_DELTA,
AS_DRAW_STRING_WITH_OFFSETS,
AS_SYNC,
AS_VIEW_CREATE,
AS_VIEW_DELETE,
AS_VIEW_CREATE_ROOT,
AS_VIEW_SHOW,
AS_VIEW_HIDE,
AS_VIEW_MOVE,
AS_VIEW_RESIZE,
AS_VIEW_DRAW,
// View/Layer definitions
AS_VIEW_GET_COORD,
AS_VIEW_SET_FLAGS,
AS_VIEW_SET_ORIGIN,
AS_VIEW_GET_ORIGIN,
AS_VIEW_RESIZE_MODE,
AS_VIEW_BEGIN_RECT_TRACK,
AS_VIEW_END_RECT_TRACK,
AS_VIEW_DRAG_RECT,
AS_VIEW_DRAG_IMAGE,
AS_VIEW_SCROLL,
AS_VIEW_SET_LINE_MODE,
AS_VIEW_GET_LINE_MODE,
AS_VIEW_PUSH_STATE,
AS_VIEW_POP_STATE,
AS_VIEW_SET_SCALE,
AS_VIEW_GET_SCALE,
AS_VIEW_SET_DRAWING_MODE,
AS_VIEW_GET_DRAWING_MODE,
AS_VIEW_SET_BLENDING_MODE,
AS_VIEW_GET_BLENDING_MODE,
AS_VIEW_SET_PEN_LOC,
AS_VIEW_GET_PEN_LOC,
AS_VIEW_SET_PEN_SIZE,
AS_VIEW_GET_PEN_SIZE,
AS_VIEW_SET_HIGH_COLOR,
AS_VIEW_SET_LOW_COLOR,
AS_VIEW_SET_VIEW_COLOR,
AS_VIEW_GET_HIGH_COLOR,
AS_VIEW_GET_LOW_COLOR,
AS_VIEW_GET_VIEW_COLOR,
AS_VIEW_PRINT_ALIASING,
AS_VIEW_CLIP_TO_PICTURE,
AS_VIEW_GET_CLIP_REGION,
AS_VIEW_DRAW_BITMAP,
AS_VIEW_SET_EVENT_MASK,
AS_VIEW_SET_MOUSE_EVENT_MASK,
AS_VIEW_DRAW_STRING,
AS_VIEW_SET_CLIP_REGION,
AS_VIEW_LINE_ARRAY,
AS_VIEW_BEGIN_PICTURE,
AS_VIEW_APPEND_TO_PICTURE,
AS_VIEW_END_PICTURE,
AS_VIEW_COPY_BITS,
AS_VIEW_DRAW_PICTURE,
AS_VIEW_INVALIDATE_RECT,
AS_VIEW_INVALIDATE_REGION,
AS_VIEW_INVERT_RECT,
AS_VIEW_MOVE_TO,
AS_VIEW_RESIZE_TO,
AS_VIEW_SET_STATE,
AS_VIEW_SET_FONT_STATE,
AS_VIEW_GET_STATE,
AS_VIEW_SET_VIEW_BITMAP,
AS_VIEW_SET_PATTERN,
AS_SET_CURRENT_VIEW,
app_server: add new BView layers API * Add new methods BView::BeginLayer(uint8 opacity) BView::EndLayer() * All drawing between begin and end of a layer is redirected onto an intermediate bitmap. When ending the layer, this bitmap is composited onto the view with the opacity given when the layer was started. * Layers can be nested arbitrarily and will be blended onto each other in order. There can also be any arbitrary interleaving of layer begin/end and drawing operations. * Internally, drawing commands are redirected into a BPicture between BeginLayer and EndLayer (but client code need not know or care about this). Client code can also start/end other BPictures while inside a layer. * Uses the PictureBoundingBoxPlayer to determine the size of the layer bitmap before allocating and drawing into it, so it does not allocate more memory than necessary and -- more importantly -- it will not alpha-composite more pixels than necessary. * Drawing mode is always set to B_OP_ALPHA, blend mode to (B_PIXEL_ALPHA, B_ALPHA_COMPOSITE) while inside layers. This is necessary for (a) correct compositing output and (b) for redirection of drawing into the intermediate bitmap, which uses the renderer_region offset (in B_OP_COPY, the Painter does not use the AGG renderer methods, it directly accesses the pixel data. This would access out-of-bounds without the offset, so B_OP_COPY cannot be allowed.) To ensure these modes aren't changed, BView::SetDrawingMode() and BView::SetBlendingMode() are ignored while inside a layer. * The main motivation behind this new API is WebKit, which internally expects such a layers functionality to be present. A performant and reusable implementation of this functionality can only be done server-side in app_server.
2015-07-25 16:44:23 +03:00
AS_VIEW_BEGIN_LAYER,
AS_VIEW_END_LAYER,
// BDirectWindow/BWindowScreen codes
AS_DIRECT_WINDOW_GET_SYNC_DATA,
AS_DIRECT_WINDOW_SET_FULLSCREEN,
AS_DIRECT_SCREEN_LOCK,
// desktop listener communications
AS_TALK_TO_DESKTOP_LISTENER,
// debugging helper
AS_DUMP_ALLOCATOR,
AS_DUMP_BITMAPS,
// transformation in addition to origin/scale
AS_VIEW_SET_TRANSFORM,
AS_VIEW_GET_TRANSFORM,
// Polygon filling rules
AS_VIEW_SET_FILL_RULE,
AS_VIEW_GET_FILL_RULE,
AS_LAST_CODE
};
// TODO: move this into a private app header, together with the rest of the
// private message definitions in AppDefs.h
enum {
kMsgDeleteServerMemoryArea = '_DSA',
};
// bitmap allocation flags
enum {
kAllocator = 0x1,
kFramebuffer = 0x2,
kHeap = 0x4,
kNewAllocatorArea = 0x8,
};
#endif // APP_SERVER_PROTOCOL_H