Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libvisual/po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libvisual 0.4.0-2.2\n"
"Report-Msgid-Bugs-To: https://github.com/Libvisual/libvisual/issues/\n"
"POT-Creation-Date: 2023-02-01 21:15+0100\n"
"POT-Creation-Date: 2023-02-04 23:12+0100\n"
"PO-Revision-Date: 2017-08-10 18:46+GMT\n"
"Last-Translator: Chris Leick <c.leick@vollbio.de>\n"
"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
Expand Down Expand Up @@ -900,7 +900,7 @@ msgstr ""
msgid "Invalid depth passed to the scaler"
msgstr "Ungültige Tiefe an Scaler übergeben"

#: tools/lv-tool/lv-tool.cpp:837 tools/lv-tool/lv-tool.cpp:934
#: tools/lv-tool/lv-tool.cpp:881 tools/lv-tool/lv-tool.cpp:1062
msgid "lv-tool"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions libvisual/po/es_AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Libvisual Library 0.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/Libvisual/libvisual/issues/\n"
"POT-Creation-Date: 2023-02-01 21:15+0100\n"
"POT-Creation-Date: 2023-02-04 23:12+0100\n"
"PO-Revision-Date: 2005-03-20 17:09-0300\n"
"Last-Translator: <dprotti@users.sourceforge.net>\n"
"Language-Team: Spanish\n"
Expand Down Expand Up @@ -918,7 +918,7 @@ msgstr ""
msgid "Invalid depth passed to the scaler"
msgstr "Profundidad pasada al escalador inválida"

#: tools/lv-tool/lv-tool.cpp:837 tools/lv-tool/lv-tool.cpp:934
#: tools/lv-tool/lv-tool.cpp:881 tools/lv-tool/lv-tool.cpp:1062
msgid "lv-tool"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions libvisual/po/es_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Libvisual Library 0.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/Libvisual/libvisual/issues/\n"
"POT-Creation-Date: 2023-02-01 21:15+0100\n"
"POT-Creation-Date: 2023-02-04 23:12+0100\n"
"PO-Revision-Date: 2005-03-20 17:09-0300\n"
"Last-Translator: <dprotti@users.sourceforge.net>\n"
"Language-Team: Spanish\n"
Expand Down Expand Up @@ -918,7 +918,7 @@ msgstr ""
msgid "Invalid depth passed to the scaler"
msgstr "Profundidad pasada al escalador inválida"

#: tools/lv-tool/lv-tool.cpp:837 tools/lv-tool/lv-tool.cpp:934
#: tools/lv-tool/lv-tool.cpp:881 tools/lv-tool/lv-tool.cpp:1062
msgid "lv-tool"
msgstr ""

Expand Down
4 changes: 2 additions & 2 deletions libvisual/po/libvisual-0.4.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: libvisual 0.4.1\n"
"Report-Msgid-Bugs-To: https://github.com/Libvisual/libvisual/issues/\n"
"POT-Creation-Date: 2023-02-01 21:15+0100\n"
"POT-Creation-Date: 2023-02-04 23:12+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -871,6 +871,6 @@ msgstr ""
msgid "Invalid depth passed to the scaler"
msgstr ""

#: tools/lv-tool/lv-tool.cpp:837 tools/lv-tool/lv-tool.cpp:934
#: tools/lv-tool/lv-tool.cpp:881 tools/lv-tool/lv-tool.cpp:1062
msgid "lv-tool"
msgstr ""
76 changes: 63 additions & 13 deletions libvisual/tools/lv-tool/lv-tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,21 @@ namespace LV {
return Time(SDL_GetTicks());
}

Time operator-(Time & other) const {
return Time(this->m_moment - other.m_moment);
friend Time operator-(Time const& lhs, Time const& rhs) {
return Time(lhs.m_moment - rhs.m_moment);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason to implement the subtraction operator as a member function? The implementation in master uses a free function, following the practice of the C++ standard library.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaixiong no particular reason, changed now as suggested.

friend bool operator>=(Time const& lhs, Time const& rhs) {
return lhs.m_moment >= rhs.m_moment;
}

//! Converts the time to seconds
double to_secs() const
{
return this->m_moment / 1000.0;
}

//! Converts the time to microseconds
uint64_t to_usecs() const {
return this->m_moment * 1000;
};
Expand Down Expand Up @@ -455,6 +466,39 @@ namespace {
}
};

class ResizeRequest
{
unsigned int m_width;
unsigned int m_height;
LV::Time m_received_at;
LV::Time m_applied_at;

public:
ResizeRequest() : m_width(0), m_height(0) {
}

unsigned int width() const { return m_width; }
unsigned int height() const { return m_height; }

bool is_due() const {
if (m_applied_at >= m_received_at) {
return false;
}
const double seconds_passed = (LV::Time::now() - m_received_at).to_secs();
return seconds_passed >= 0.2; // >=300ms is known to feel slow to humans

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to backport LV::Time::to_secs() and use that instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaixiong good idea, done

}

void store(unsigned int width, unsigned int height) {
m_width = width;
m_height = height;
m_received_at = LV::Time::now();
}

void mark_as_applied() {
m_applied_at = LV::Time::now();
}
};

/** print info about libvisual plugin */
void print_plugin_info(VisPluginInfo const& info)
{
Expand Down Expand Up @@ -856,6 +900,7 @@ int main (int argc, char **argv)

// main loop
bool running = true;
ResizeRequest resize_request;
//bool visible = true;

while (running)
Expand Down Expand Up @@ -925,17 +970,7 @@ int main (int argc, char **argv)

case VISUAL_EVENT_RESIZE:
{
DisplayLock lock {display};

width = ev.event.resize.width;
height = ev.event.resize.height;

video = display.create(depth, vidoptions, width, height, true);
display.set_title(_("lv-tool"));

bin.set_video (video);
bin.sync(false);

resize_request.store(ev.event.resize.width, ev.event.resize.height);
break;
}

Expand Down Expand Up @@ -1017,6 +1052,21 @@ int main (int argc, char **argv)
}
}

if (resize_request.is_due ()) {
DisplayLock lock {display};

width = resize_request.width();
height = resize_request.height();

video = display.create(depth, vidoptions, width, height, true);
display.set_title(_("lv-tool"));

bin.set_video (video);
bin.sync(false);

resize_request.mark_as_applied();
}

if (bin.depth_changed())
{
DisplayLock lock {display};
Expand Down