Skip to content

Commit

Permalink
Revert "UI: Disable hotkeys when a user is expected to type text"
Browse files Browse the repository at this point in the history
This reverts commit f832d14.

Reverting this until we do more investigation. Currently, any text
that can be typed in a dialog requires the dialog to re-enable hotkeys
on destruction, which is frustrating. There has to be a better way.
  • Loading branch information
jp9000 committed Oct 3, 2021
1 parent 1df2789 commit da04907
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 24 deletions.
2 changes: 0 additions & 2 deletions UI/source-tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ void SourceTreeItem::EnterEditMode()
editor->installEventFilter(this);
boxLayout->insertWidget(index, editor);
setFocusProxy(editor);
App()->DisableHotkeys();
}

void SourceTreeItem::ExitEditMode(bool save)
Expand Down Expand Up @@ -416,7 +415,6 @@ void SourceTreeItem::ExitEditModeInternal(bool save)
setFocusPolicy(Qt::NoFocus);
boxLayout->insertWidget(index, label);
label->setFocus();
App()->UpdateHotkeyFocusSetting();

/* ----------------------------------------- */
/* check for empty string */
Expand Down
2 changes: 0 additions & 2 deletions UI/window-basic-filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,6 @@ void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
list->editItem(item);
item->setFlags(flags);
editActive = true;
App()->DisableHotkeys();
}

void OBSBasicFilters::DuplicateItem(QListWidgetItem *item)
Expand Down Expand Up @@ -1108,7 +1107,6 @@ void OBSBasicFilters::FilterNameEdited(QWidget *editor, QListWidget *list)
listItem->setText(QString());
SetupVisibilityItem(list, listItem, filter);
editActive = false;
App()->UpdateHotkeyFocusSetting();
}

void OBSBasicFilters::AsyncFilterNameEdited(
Expand Down
2 changes: 0 additions & 2 deletions UI/window-basic-interaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
};

connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback);
App()->DisableHotkeys();
}

OBSBasicInteraction::~OBSBasicInteraction()
{
// since QT fakes a mouse movement while destructing a widget
// remove our event filter
ui->preview->removeEventFilter(eventFilter.get());
App()->UpdateHotkeyFocusSetting();
}

OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
Expand Down
7 changes: 0 additions & 7 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4831,7 +4831,6 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,

void OBSBasic::EditSceneName()
{
App()->DisableHotkeys();
ui->scenesDock->removeAction(renameScene);
QListWidgetItem *item = ui->scenes->currentItem();
Qt::ItemFlags flags = item->flags();
Expand Down Expand Up @@ -5065,9 +5064,7 @@ void OBSBasic::on_actionAddScene_triggered()

void OBSBasic::on_actionRemoveScene_triggered()
{
App()->DisableHotkeys();
RemoveSelectedScene();
App()->UpdateHotkeyFocusSetting();
}

void OBSBasic::ChangeSceneIndex(bool relative, int offset, int invalidIdx)
Expand Down Expand Up @@ -5757,8 +5754,6 @@ void OBSBasic::on_actionRemoveSource_triggered()
if (!confirmed)
return;

App()->DisableHotkeys();

/* ----------------------------------------------- */
/* save undo data */

Expand Down Expand Up @@ -5789,7 +5784,6 @@ void OBSBasic::on_actionRemoveSource_triggered()
}

CreateSceneUndoRedoAction(action_name, undo_data, redo_data);
App()->UpdateHotkeyFocusSetting();
}

void OBSBasic::on_actionInteract_triggered()
Expand Down Expand Up @@ -6075,7 +6069,6 @@ static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
void OBSBasic::SceneNameEdited(QWidget *editor,
QAbstractItemDelegate::EndEditHint endHint)
{
App()->UpdateHotkeyFocusSetting();
OBSScene scene = GetCurrentScene();
QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
string text = QT_TO_UTF8(edit->text().trimmed());
Expand Down
3 changes: 0 additions & 3 deletions UI/window-basic-properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
} else {
preview->hide();
}

App()->DisableHotkeys();
}

OBSBasicProperties::~OBSBasicProperties()
Expand All @@ -226,7 +224,6 @@ OBSBasicProperties::~OBSBasicProperties()
obs_source_dec_showing(source);
main->SaveProject();
main->UpdateContextBar();
App()->UpdateHotkeyFocusSetting();
}

void OBSBasicProperties::AddPreviewButton()
Expand Down
4 changes: 0 additions & 4 deletions UI/window-basic-source-select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,11 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
obs_sceneitem_release(item);
}

App()->UpdateHotkeyFocusSetting();
done(DialogCode::Accepted);
}

void OBSBasicSourceSelect::on_buttonBox_rejected()
{
App()->UpdateHotkeyFocusSetting();
done(DialogCode::Rejected);
}

Expand Down Expand Up @@ -378,8 +376,6 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_,
} else {
obs_enum_sources(EnumSources, this);
}

App()->DisableHotkeys();
}

void OBSBasicSourceSelect::SourcePaste(const char *name, bool visible, bool dup)
Expand Down
4 changes: 0 additions & 4 deletions UI/window-namedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
const QString &text, std::string &userTextInput,
const QString &placeHolder, int maxSize)
{
App()->DisableHotkeys();
if (maxSize <= 0 || maxSize > 32767)
maxSize = 170;

Expand All @@ -85,7 +84,6 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
}
userTextInput = dialog.userText->text().toUtf8().constData();
CleanWhitespace(userTextInput);
App()->UpdateHotkeyFocusSetting();
return true;
}

Expand All @@ -96,7 +94,6 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
bool &optionChecked,
const QString &placeHolder)
{
App()->DisableHotkeys();
NameDialog dialog(parent);
dialog.setWindowTitle(title);

Expand All @@ -113,6 +110,5 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
userTextInput = dialog.userText->text().toUtf8().constData();
CleanWhitespace(userTextInput);
optionChecked = dialog.checkbox->isChecked();
App()->UpdateHotkeyFocusSetting();
return true;
}

0 comments on commit da04907

Please sign in to comment.