mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Prune obs_display code from secondary windows
(Non-compiling commit: windowless-context branch) Now that all obs_display related code has been moved to OBSQTDisplay, we can prune a whole bunch of boilerplate code that had to be repeated for the displays of each window. Affects: - Properties - Filters - Interact - Projector
This commit is contained in:
@@ -17,6 +17,14 @@ OBSProjector::OBSProjector(QWidget *widget, obs_source_t *source_)
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
installEventFilter(CreateShortcutFilter());
|
||||
|
||||
auto addDrawCallback = [this] ()
|
||||
{
|
||||
obs_display_add_draw_callback(GetDisplay(), OBSRender, this);
|
||||
obs_display_set_background_color(GetDisplay(), 0x000000);
|
||||
};
|
||||
|
||||
connect(this, &OBSQTDisplay::DisplayCreated, addDrawCallback);
|
||||
}
|
||||
|
||||
OBSProjector::~OBSProjector()
|
||||
@@ -38,16 +46,6 @@ void OBSProjector::Init(int monitor)
|
||||
if (source)
|
||||
obs_source_inc_showing(source);
|
||||
|
||||
struct gs_init_data gid = {};
|
||||
gid.cx = mi.cx;
|
||||
gid.cy = mi.cy;
|
||||
gid.format = GS_RGBA;
|
||||
QTToGSWindow(winId(), gid.window);
|
||||
|
||||
display = obs_display_create(&gid);
|
||||
obs_display_set_background_color(display, 0x000000);
|
||||
obs_display_add_draw_callback(display, OBSRender, this);
|
||||
|
||||
QAction *action = new QAction(this);
|
||||
action->setShortcut(Qt::Key_Escape);
|
||||
addAction(action);
|
||||
|
||||
Reference in New Issue
Block a user