"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/aguix/aguix.cc" between
worker-4.7.0.tar.bz2 and worker-4.8.0.tar.bz2

About: Worker is a file manager for the X Window System with the classical two panel interface.

aguix.cc  (worker-4.7.0.tar.bz2):aguix.cc  (worker-4.8.0.tar.bz2)
/* aguix.cc /* aguix.cc
* This file belongs to Worker, a file manager for UN*X/X11. * This file belongs to Worker, a file manager for UN*X/X11.
* Copyright (C) 2001-2020 Ralf Hoffmann. * Copyright (C) 2001-2021 Ralf Hoffmann.
* You can contact me at: ralf@boomerangsworld.de * You can contact me at: ralf@boomerangsworld.de
* or http://www.boomerangsworld.de/worker * or http://www.boomerangsworld.de/worker
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 769 skipping to change at line 769
#endif #endif
Atom *AGUIX::getCloseAtom() Atom *AGUIX::getCloseAtom()
{ {
return &WM_delete_window; return &WM_delete_window;
} }
void AGUIX::insertWindow( AWindow *win, bool change_transient ) void AGUIX::insertWindow( AWindow *win, bool change_transient )
{ {
if(win==NULL) return; if(win==NULL) return;
if ( msg_handler_active ) {
// inserting new windows during msg handler is ok but should not
// be done for consistency
std::cerr << "Inserting window during X message loop discouraged" << std::
endl;
}
wins.push_back( win ); wins.push_back( win );
if ( win->isTopLevel() == true && change_transient ) { if ( win->isTopLevel() == true && change_transient ) {
setTransientWindow( win ); setTransientWindow( win );
} }
} }
void AGUIX::removeWindow(AWindow *win) void AGUIX::removeWindow(AWindow *win)
{ {
if(win==NULL) return; if(win==NULL) return;
if ( msg_handler_active ) {
std::cerr << "Deleting window during X message loop forbidden" << std::end
l;
abort();
}
PopUpWindow *popwin = dynamic_cast<PopUpWindow*>( win ); PopUpWindow *popwin = dynamic_cast<PopUpWindow*>( win );
if ( popwin != NULL ) { if ( popwin != NULL ) {
popup_wins.remove( popwin ); popup_wins.remove( popwin );
} }
wins.remove( win ); wins.remove( win );
wins_as_transient_for.remove( win ); wins_as_transient_for.remove( win );
if ( win == transientwindow ) { if ( win == transientwindow ) {
AWindow *new_transient_win = NULL; AWindow *new_transient_win = NULL;
skipping to change at line 1493 skipping to change at line 1505
int AGUIX::msgHandler( int mode, AWindow *parent, bool onlyExpose ) int AGUIX::msgHandler( int mode, AWindow *parent, bool onlyExpose )
{ {
Message *tmsg; Message *tmsg;
int waitmode; int waitmode;
long timerEventNr; long timerEventNr;
struct timeval curTime; struct timeval curTime;
#ifndef USE_AGUIXTIMER #ifndef USE_AGUIXTIMER
long t1; long t1;
#endif #endif
msg_handler_active = true;
// do not limit to special window if there is a guielement // do not limit to special window if there is a guielement
// holding the lock // holding the lock
if ( msgLockElement != NULL ) parent = NULL; if ( msgLockElement != NULL ) parent = NULL;
now = time( NULL ); now = time( NULL );
for (;;) { for (;;) {
waitmode = mode; waitmode = mode;
// do not wait when timer is enabled // do not wait when timer is enabled
skipping to change at line 1617 skipping to change at line 1631
// test again for timer since the timer message could // test again for timer since the timer message could
// have disabled the timer // have disabled the timer
if ( ! ( ( msgLockElement != NULL ) && if ( ! ( ( msgLockElement != NULL ) &&
( timerEnabled == true ) ) ) { ( timerEnabled == true ) ) ) {
break; break;
} }
} }
gettimeofday( &curTime, NULL ); gettimeofday( &curTime, NULL );
msg_handler_active = false;
if ( m_bubble_help.help_candidate && if ( m_bubble_help.help_candidate &&
ldiffgtod_m( &curTime, &m_bubble_help.enter_time ) >= BUBBLE_HELP_OPEN_TI ME_MS ) { ldiffgtod_m( &curTime, &m_bubble_help.enter_time ) >= BUBBLE_HELP_OPEN_TI ME_MS ) {
m_bubble_help.help_candidate->openBubbleHelp(); m_bubble_help.help_candidate->openBubbleHelp();
clearBubbleHelpCandidate(); clearBubbleHelpCandidate();
} }
for ( auto &f : m_post_msg_handler_cbs ) {
f();
}
m_post_msg_handler_cbs.clear();
return XEventsQueued( dsp, QueuedAfterFlush ); return XEventsQueued( dsp, QueuedAfterFlush );
} }
AGMessage *AGUIX::GetMessage(AWindow *parent) AGMessage *AGUIX::GetMessage(AWindow *parent)
{ {
msgHandler( MES_GET, parent, false ); msgHandler( MES_GET, parent, false );
return getAGMsg(); return getAGMsg();
} }
AGMessage *AGUIX::WaitMessage(AWindow *parent) AGMessage *AGUIX::WaitMessage(AWindow *parent)
skipping to change at line 1725 skipping to change at line 1746
} }
} }
// with lockElement don't quit this loop // with lockElement don't quit this loop
if ( msg->lockElement != NULL ) returnvalue = false; if ( msg->lockElement != NULL ) returnvalue = false;
} }
if ( msg->loop == 0 && msg->type == LeaveNotify ) { if ( msg->loop == 0 && msg->type == LeaveNotify ) {
if ( m_bubble_help.bubble_help_window ) { if ( m_bubble_help.bubble_help_window ) {
if ( m_bubble_help.bubble_help_window->ownedByLinkedWidget( msg->w indow ) || if ( m_bubble_help.bubble_help_window->ownedByLinkedWidget( msg->w indow ) ||
m_bubble_help.bubble_help_window->isParent( msg->window, fals e ) ) { m_bubble_help.bubble_help_window->isParent( msg->window, fals e ) ) {
m_bubble_help.bubble_help_window->hide();
// execute at end of event handler
pushPostMsgHandlerCB( [this, w = m_bubble_help.bubble_help_win
dow]() {
// we have an own reference so it get destroyed
// when leaving this function
w->hide();
});
// reset shared_ptr, but reference still lives in
// msg handler
m_bubble_help.bubble_help_window.reset(); m_bubble_help.bubble_help_window.reset();
} }
} }
clearBubbleHelpCandidate(); clearBubbleHelpCandidate();
} }
if ( msg->lockElement != NULL ) { if ( msg->lockElement != NULL ) {
// there is a lock element // there is a lock element
// check whether the element accepted this msg // check whether the element accepted this msg
// ack should be false only when the element doesn't exists anymore // ack should be false only when the element doesn't exists anymore
skipping to change at line 3814 skipping to change at line 3844
m_external_timeouts.timeout_store = timeout_store; m_external_timeouts.timeout_store = timeout_store;
} }
void AGUIX::external_timeout_callback() void AGUIX::external_timeout_callback()
{ {
struct timeval curTime; struct timeval curTime;
gettimeofday( &curTime, NULL ); gettimeofday( &curTime, NULL );
if ( m_bubble_help.help_candidate && if ( m_bubble_help.help_candidate &&
ldiffgtod_m( &curTime, &m_bubble_help.enter_time ) >= BUBBLE_HELP_OPEN_ TIME_MS ) { ldiffgtod_m( &curTime, &m_bubble_help.enter_time ) >= BUBBLE_HELP_OPEN_ TIME_MS ) {
m_bubble_help.help_candidate->openBubbleHelp();
if ( getFocusedAWindow() ) {
if ( getFocusedAWindow()->isParent( m_bubble_help.help_candidate->ge
tWindow() ) ) {
m_bubble_help.help_candidate->openBubbleHelp();
}
}
clearBubbleHelpCandidate(); clearBubbleHelpCandidate();
} }
} }
/* returning true means you can ask for next X event without /* returning true means you can ask for next X event without
* blocking (except when I do not have the fd to wait on * blocking (except when I do not have the fd to wait on
*/ */
bool AGUIX::waitForEventOnFD( int ms ) bool AGUIX::waitForEventOnFD( int ms )
{ {
#ifdef HAVE_XCONNECTIONNUMBER #ifdef HAVE_XCONNECTIONNUMBER
skipping to change at line 4395 skipping to change at line 4430
{ {
if ( ! m_net_wm_icon_data ) return false; if ( ! m_net_wm_icon_data ) return false;
if ( ! return_data ) return false; if ( ! return_data ) return false;
if ( ! return_data_length ) return false; if ( ! return_data_length ) return false;
*return_data = m_net_wm_icon_data; *return_data = m_net_wm_icon_data;
*return_data_length = m_net_wm_icon_data_length; *return_data_length = m_net_wm_icon_data_length;
return true; return true;
} }
void AGUIX::closeBubbleHelp( AWindow *awin )
{
if ( ! awin ) {
return;
}
if ( ! m_bubble_help.bubble_help_window ) {
return;
}
if ( m_bubble_help.bubble_help_window ) {
// it would be more precise to check if the awindow is the
// parent of the linked widget of the bubblewindow. But on
// focus out it can be closed anyway.
pushPostMsgHandlerCB( [this, w = m_bubble_help.bubble_help_window]() {
// we have an own reference so it get destroyed
// when leaving this function
w->hide();
});
// reset shared_ptr, but reference still lives in
// msg handler
m_bubble_help.bubble_help_window.reset();
}
}
void AGUIX::pushPostMsgHandlerCB( std::function< void(void) > f )
{
m_post_msg_handler_cbs.push_back( f );
}
 End of changes. 9 change blocks. 
3 lines changed or deleted 42 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)