| 1 | // SPDX-License-Identifier: MPL-2.0 |
| 2 | // Copyright (c) Yuxuan Shui <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | typedef enum { |
| 7 | WINTYPE_UNKNOWN = 0, |
| 8 | WINTYPE_DESKTOP, |
| 9 | WINTYPE_DOCK, |
| 10 | WINTYPE_TOOLBAR, |
| 11 | WINTYPE_MENU, |
| 12 | WINTYPE_UTILITY, |
| 13 | WINTYPE_SPLASH, |
| 14 | WINTYPE_DIALOG, |
| 15 | WINTYPE_NORMAL, |
| 16 | WINTYPE_DROPDOWN_MENU, |
| 17 | WINTYPE_POPUP_MENU, |
| 18 | WINTYPE_TOOLTIP, |
| 19 | WINTYPE_NOTIFICATION, |
| 20 | WINTYPE_COMBO, |
| 21 | WINTYPE_DND, |
| 22 | NUM_WINTYPES |
| 23 | } wintype_t; |
| 24 | |
| 25 | /// Enumeration type of window painting mode. |
| 26 | typedef enum { |
| 27 | WMODE_TRANS, // The window body is (potentially) transparent |
| 28 | WMODE_FRAME_TRANS, // The window body is opaque, but the frame is not |
| 29 | WMODE_SOLID, // The window is opaque including the frame |
| 30 | } winmode_t; |
| 31 | |
| 32 | /// The state of a window from Xserver's perspective |
| 33 | typedef enum { |
| 34 | /// The window is unmapped. Equivalent to map-state == XCB_MAP_STATE_UNMAPPED |
| 35 | WSTATE_UNMAPPED, |
| 36 | /// The window no longer exists on the X server. |
| 37 | WSTATE_DESTROYED, |
| 38 | /// The window is mapped and viewable. Equivalent to map-state == |
| 39 | /// XCB_MAP_STATE_VIEWABLE |
| 40 | WSTATE_MAPPED, |
| 41 | // XCB_MAP_STATE_UNVIEWABLE is not represented here because it should not be |
| 42 | // possible for top-level windows. |
| 43 | } winstate_t; |
| 44 | |
| 45 | #define NUM_OF_WSTATES (WSTATE_MAPPED + 1) |
| 46 | |
| 47 | enum win_flags { |
| 48 | // Note: *_NONE flags are mostly redundant and meant for detecting logical errors |
| 49 | // in the code |
| 50 | |
| 51 | /// pixmap is out of date, will be update in win_process_flags |
| 52 | WIN_FLAGS_PIXMAP_STALE = 1, |
| 53 | /// there was an error binding the window pixmap |
| 54 | WIN_FLAGS_PIXMAP_ERROR = 4, |
| 55 | /// the client window needs to be updated |
| 56 | WIN_FLAGS_CLIENT_STALE = 32, |
| 57 | /// the window is mapped by X, we need to call map_win_start for it |
| 58 | WIN_FLAGS_MAPPED = 64, |
| 59 | /// this window has properties which needs to be updated |
| 60 | WIN_FLAGS_PROPERTY_STALE = 128, |
| 61 | // TODO(yshui) _maybe_ split SIZE_STALE into SIZE_STALE and SHAPE_STALE |
| 62 | /// this window has an unhandled size/shape change |
| 63 | WIN_FLAGS_SIZE_STALE = 256, |
| 64 | /// this window has an unhandled position (i.e. x and y) change |
| 65 | WIN_FLAGS_POSITION_STALE = 512, |
| 66 | /// need better name for this, is set when some aspects of the window changed |
| 67 | WIN_FLAGS_FACTOR_CHANGED = 1024, |
| 68 | }; |
| 69 | |
| 70 | enum win_script_output { |
| 71 | /// Additional X offset of the window. |
| 72 | WIN_SCRIPT_OFFSET_X = 0, |
| 73 | /// Additional Y offset of the window. |
| 74 | WIN_SCRIPT_OFFSET_Y, |
| 75 | /// Additional X offset of the shadow. |
| 76 | WIN_SCRIPT_SHADOW_OFFSET_X, |
| 77 | /// Additional Y offset of the shadow. |
| 78 | WIN_SCRIPT_SHADOW_OFFSET_Y, |
| 79 | /// Opacity of the window. |
| 80 | WIN_SCRIPT_OPACITY, |
| 81 | /// Opacity of the blurred background of the window. |
| 82 | WIN_SCRIPT_BLUR_OPACITY, |
| 83 | /// Opacity of the shadow. |
| 84 | WIN_SCRIPT_SHADOW_OPACITY, |
| 85 | /// Horizontal scale |
| 86 | WIN_SCRIPT_SCALE_X, |
| 87 | /// Vertical scale |
| 88 | WIN_SCRIPT_SCALE_Y, |
| 89 | /// Horizontal scale of the shadow |
| 90 | WIN_SCRIPT_SHADOW_SCALE_X, |
| 91 | /// Vertical scale of the shadow |
| 92 | WIN_SCRIPT_SHADOW_SCALE_Y, |
| 93 | /// X coordinate of the origin of the crop box |
| 94 | WIN_SCRIPT_CROP_X, |
| 95 | /// Y coordinate of the origin of the crop box |
| 96 | WIN_SCRIPT_CROP_Y, |
| 97 | /// Width of the crop box |
| 98 | WIN_SCRIPT_CROP_WIDTH, |
| 99 | /// Height of the crop box |
| 100 | WIN_SCRIPT_CROP_HEIGHT, |
| 101 | /// How much to blend in the saved window image |
| 102 | WIN_SCRIPT_SAVED_IMAGE_BLEND, |
| 103 | /// Color for this window's shadow |
| 104 | WIN_SCRIPT_SHADOW_RED, |
| 105 | /// Ditto |
| 106 | WIN_SCRIPT_SHADOW_GREEN, |
| 107 | /// Ditto |
| 108 | WIN_SCRIPT_SHADOW_BLUE, |
| 109 | |
| 110 | NUM_OF_WIN_SCRIPT_OUTPUTS, |
| 111 | }; |