Skip to content

Commit d9191e5

Browse files
committed
Tracking surface type
1 parent 7bd8b03 commit d9191e5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

include/lsp-plug.in/tk/widgets/containers/Window.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ namespace lsp
9696
Widget *pFocused; // Focused widget
9797
bool bMapped;
9898
bool bOverridePointer;
99+
ws::surface_type_t enSurfaceType; // Surface type
99100
float fScaling; // Cached scaling factor
100101
Shortcuts sShortcuts; // Shortcuts
101102
ShortcutTracker sShortcutTracker; // Shortcut tracker
@@ -283,6 +284,9 @@ namespace lsp
283284
status_t set_class(const char *instance, const char *wclass);
284285
status_t set_class(const LSPString *instance, const LSPString *wclass);
285286

287+
// Get last surface type used
288+
ws::surface_type_t surface_type() const;
289+
286290
//---------------------------------------------------------------------------------
287291
// Event handling
288292
public:

src/main/widgets/containers/Window.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ namespace lsp
9090
pNativeHandle = handle;
9191
bMapped = false;
9292
bOverridePointer= false;
93+
enSurfaceType = ws::ST_UNKNOWN;
9394
fScaling = 1.0f;
9495
pActor = NULL;
9596

@@ -369,6 +370,8 @@ namespace lsp
369370
if (s == NULL)
370371
return STATUS_OK;
371372

373+
enSurfaceType = s->type();
374+
372375
// #ifdef LSP_TRACE
373376
// system::time_millis_t time = system::get_time_millis();
374377
// #endif /* LSP_TRACE */
@@ -901,6 +904,11 @@ namespace lsp
901904
bMapped = true;
902905
sRedraw.launch(-1, 40);
903906
query_draw(REDRAW_SURFACE);
907+
908+
// Remember surface type
909+
ws::ISurface *s = pWindow->get_surface();
910+
if (s != NULL)
911+
enSurfaceType = s->type();
904912
}
905913
sShortcutTracker.reset();
906914
sVisibility.commit_value(true);
@@ -1573,5 +1581,10 @@ namespace lsp
15731581
return (pWindow != NULL) ? pWindow->has_parent() : false;
15741582
}
15751583

1584+
ws::surface_type_t Window::surface_type() const
1585+
{
1586+
return enSurfaceType;
1587+
}
1588+
15761589
} /* namespace tk */
15771590
} /* namespace lsp */

0 commit comments

Comments
 (0)