Threading improvement
This commit is contained in:
@@ -54,11 +54,6 @@ ThumbBrowserBase::ThumbBrowserBase ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ThumbBrowserBase::scrollChanged () {
|
void ThumbBrowserBase::scrollChanged () {
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); i++)
|
for (int i=0; i<fd.size(); i++)
|
||||||
fd[i]->setOffset ((int)(hscroll.get_value()), (int)(vscroll.get_value()));
|
fd[i]->setOffset ((int)(hscroll.get_value()), (int)(vscroll.get_value()));
|
||||||
|
|
||||||
@@ -257,11 +252,6 @@ void ThumbBrowserBase::Internal::on_realize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ThumbBrowserBase::Internal::on_query_tooltip (int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) {
|
bool ThumbBrowserBase::Internal::on_query_tooltip (int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip) {
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(parent->entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Glib::ustring ttip = "";
|
Glib::ustring ttip = "";
|
||||||
for (int i=0; i<parent->fd.size(); i++)
|
for (int i=0; i<parent->fd.size(); i++)
|
||||||
if (parent->fd[i]->drawable && parent->fd[i]->inside (x, y)) {
|
if (parent->fd[i]->drawable && parent->fd[i]->inside (x, y)) {
|
||||||
@@ -320,19 +310,16 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ
|
|||||||
ThumbBrowserEntryBase* fileDescr = NULL;
|
ThumbBrowserEntryBase* fileDescr = NULL;
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
// TODO: Check for Linux
|
{
|
||||||
#ifdef WIN32
|
for (int i=0; i<fd.size(); i++)
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
if (fd[i]->drawable) {
|
||||||
#endif
|
if (fd[i]->inside (x, y) && fd[i]->insideWindow (clx, cly, clw, clh))
|
||||||
|
fileDescr = fd[i];
|
||||||
|
bool b = fd[i]->pressNotify (button, type, state, x, y);
|
||||||
|
handled = handled || b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); i++)
|
|
||||||
if (fd[i]->drawable) {
|
|
||||||
if (fd[i]->inside (x, y) && fd[i]->insideWindow (clx, cly, clw, clh))
|
|
||||||
fileDescr = fd[i];
|
|
||||||
bool b = fd[i]->pressNotify (button, type, state, x, y);
|
|
||||||
handled = handled || b;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (handled || (fileDescr && fileDescr->processing))
|
if (handled || (fileDescr && fileDescr->processing))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -427,11 +414,6 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
|
|||||||
|
|
||||||
Glib::RefPtr<Gdk::Window> window = get_window();
|
Glib::RefPtr<Gdk::Window> window = get_window();
|
||||||
|
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(parent->entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int w = get_width();
|
int w = get_width();
|
||||||
int h = get_height();
|
int h = get_height();
|
||||||
|
|
||||||
@@ -452,33 +434,27 @@ bool ThumbBrowserBase::Internal::on_expose_event(GdkEventExpose* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ThumbBrowserBase::Internal::on_button_release_event (GdkEventButton* event) {
|
bool ThumbBrowserBase::Internal::on_button_release_event (GdkEventButton* event) {
|
||||||
|
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(parent->entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int w = get_width();
|
int w = get_width();
|
||||||
int h = get_height();
|
int h = get_height();
|
||||||
|
|
||||||
for (int i=0; i<parent->fd.size(); i++)
|
for (int i=0; i<parent->fd.size(); i++)
|
||||||
if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h))
|
if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h)) {
|
||||||
parent->fd[i]->releaseNotify (event->button, event->type, event->state, (int)event->x, (int)event->y);
|
parent->fd[i]->releaseNotify (event->button, event->type, event->state, (int)event->x, (int)event->y);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThumbBrowserBase::Internal::on_motion_notify_event (GdkEventMotion* event) {
|
bool ThumbBrowserBase::Internal::on_motion_notify_event (GdkEventMotion* event) {
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(parent->entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int w = get_width();
|
int w = get_width();
|
||||||
int h = get_height();
|
int h = get_height();
|
||||||
|
|
||||||
for (int i=0; i<parent->fd.size(); i++)
|
for (int i=0; i<parent->fd.size(); i++)
|
||||||
if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h))
|
if (parent->fd[i]->drawable && parent->fd[i]->insideWindow (0, 0, w, h)) {
|
||||||
|
#ifdef WIN32
|
||||||
|
//l.release(); // motionNotify calls the queue, which locks
|
||||||
|
#endif
|
||||||
parent->fd[i]->motionNotify ((int)event->x, (int)event->y);
|
parent->fd[i]->motionNotify ((int)event->x, (int)event->y);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,7 +494,7 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) {
|
|||||||
{
|
{
|
||||||
// TODO: Check for Linux
|
// TODO: Check for Linux
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
Glib::RWLock::WriterLock l(entryRW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); i++) fd[i]->resize (previewHeight);
|
for (int i=0; i<fd.size(); i++) fd[i]->resize (previewHeight);
|
||||||
@@ -536,7 +512,7 @@ void ThumbBrowserBase::refreshThumbImages () {
|
|||||||
{
|
{
|
||||||
// TODO: Check for Linux
|
// TODO: Check for Linux
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
Glib::RWLock::WriterLock l(entryRW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int previewHeight = getCurrentThumbSize();
|
int previewHeight = getCurrentThumbSize();
|
||||||
@@ -549,7 +525,7 @@ void ThumbBrowserBase::refreshThumbImages () {
|
|||||||
void ThumbBrowserBase::refreshQuickThumbImages () {
|
void ThumbBrowserBase::refreshQuickThumbImages () {
|
||||||
// TODO: Check for Linux
|
// TODO: Check for Linux
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
Glib::RWLock::WriterLock l(entryRW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); ++i) fd[i]->refreshQuickThumbnailImage ();
|
for (int i=0; i<fd.size(); ++i) fd[i]->refreshQuickThumbnailImage ();
|
||||||
@@ -558,15 +534,8 @@ void ThumbBrowserBase::refreshQuickThumbImages () {
|
|||||||
void ThumbBrowserBase::refreshEditedState (const std::set<Glib::ustring>& efiles) {
|
void ThumbBrowserBase::refreshEditedState (const std::set<Glib::ustring>& efiles) {
|
||||||
|
|
||||||
editedFiles = efiles;
|
editedFiles = efiles;
|
||||||
{
|
|
||||||
// TODO: Check for Linux
|
|
||||||
#ifdef WIN32
|
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); i++)
|
for (int i=0; i<fd.size(); i++)
|
||||||
fd[i]->framed = editedFiles.find (fd[i]->filename)!=editedFiles.end();
|
fd[i]->framed = editedFiles.find (fd[i]->filename)!=editedFiles.end();
|
||||||
}
|
|
||||||
|
|
||||||
queue_draw ();
|
queue_draw ();
|
||||||
}
|
}
|
||||||
@@ -585,7 +554,7 @@ void ThumbBrowserBase::enableTabMode(bool enable) {
|
|||||||
if (options.thumbSizeTab!=options.thumbSize) {
|
if (options.thumbSizeTab!=options.thumbSize) {
|
||||||
// TODO: Check for Linux
|
// TODO: Check for Linux
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
Glib::RWLock::WriterLock l(entryRW);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i=0; i<fd.size(); i++)
|
for (int i=0; i<fd.size(); i++)
|
||||||
@@ -627,19 +596,12 @@ void ThumbBrowserBase::setScrollPosition (double h, double v) {
|
|||||||
int ThumbBrowserBase::getEffectiveHeight() {
|
int ThumbBrowserBase::getEffectiveHeight() {
|
||||||
int h=hscroll.get_height() + 2; // have 2 pixels rounding error for scroll bars to appear
|
int h=hscroll.get_height() + 2; // have 2 pixels rounding error for scroll bars to appear
|
||||||
|
|
||||||
{
|
// Filtered items do not change in size, so take a non-filtered
|
||||||
// TODO: Check for Linux
|
for (int i=0;i<fd.size();i++)
|
||||||
#ifdef WIN32
|
if (!fd[i]->filtered) {
|
||||||
Glib::RWLock::ReaderLock l(entryRW);
|
h+=fd[i]->getEffectiveHeight();
|
||||||
#endif
|
break;
|
||||||
|
}
|
||||||
// Filtered items do not change in size, so take a non-filtered
|
|
||||||
for (int i=0;i<fd.size();i++)
|
|
||||||
if (!fd[i]->filtered) {
|
|
||||||
h+=fd[i]->getEffectiveHeight();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user