mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibGUI: Add GWidget::doubleclick_event().
Now double-clicking an item in a GTableView or GItemView will activate it.
This commit is contained in:
parent
43f9027968
commit
20f7d7ec67
11 changed files with 100 additions and 7 deletions
25
LibGUI/GElapsedTimer.cpp
Normal file
25
LibGUI/GElapsedTimer.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include <LibGUI/GElapsedTimer.h>
|
||||
|
||||
void GElapsedTimer::start()
|
||||
{
|
||||
gettimeofday(&m_start_time, nullptr);
|
||||
}
|
||||
|
||||
inline void timersub(const struct timeval* a, const struct timeval* b, struct timeval* result)
|
||||
{
|
||||
result->tv_sec = a->tv_sec - b->tv_sec;
|
||||
result->tv_usec = a->tv_usec - b->tv_usec;
|
||||
if (result->tv_usec < 0) {
|
||||
--result->tv_sec;
|
||||
result->tv_usec += 1000000;
|
||||
}
|
||||
}
|
||||
|
||||
int GElapsedTimer::elapsed() const
|
||||
{
|
||||
struct timeval now;
|
||||
gettimeofday(&now, nullptr);
|
||||
struct timeval diff;
|
||||
timersub(&now, &m_start_time, &diff);
|
||||
return diff.tv_sec * 1000 + diff.tv_usec / 1000;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue