1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 14:37:46 +02:00

Some random fixups

This commit is contained in:
mannol 2014-10-12 22:54:18 +02:00
parent c825adc1e3
commit 2cc261c619
4 changed files with 22 additions and 21 deletions

View File

@ -119,7 +119,7 @@ static bool notifications_are_disabled(uint64_t flags)
{
bool res = flags & NT_RESTOL && Control.cooldown > get_unix_time();
#ifdef X11
return res || (flags & NT_NOFOCUS && xtra_is_this_focused());
return res || (flags & NT_NOFOCUS && is_focused());
#else
return res;
#endif

View File

@ -128,15 +128,20 @@ void exit_toxic_success(Tox *m)
free(BLOCK_FILE);
free(user_settings);
#ifdef SOUND_NOTIFY
// sound_notify(NULL, self_log_out, NT_ALWAYS, NULL);
#endif /* SOUND_NOTIFY */
terminate_notify();
#ifdef AUDIO
terminate_audio();
#endif /* AUDIO */
tox_kill(m);
endwin();
#ifdef X11
/* We have to terminate xtra last coz reasons
* Please don't call this anywhere else coz trust me
*/
terminate_xtra();
#endif /* X11 */
exit(EXIT_SUCCESS);
}
@ -1010,7 +1015,7 @@ int main(int argc, char *argv[])
int settings_err = settings_load(user_settings, p);
#ifdef X11
xtra_init(cb);
init_xtra(cb);
#endif
Tox *m = init_tox();
@ -1041,7 +1046,7 @@ int main(int argc, char *argv[])
if (pthread_create(&cqueue_thread.tid, NULL, thread_cqueue, (void *) m) != 0)
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
#ifdef AUDIO
#ifdef AUDIO
av = init_audio(prompt, m);
@ -1055,10 +1060,6 @@ int main(int argc, char *argv[])
#endif /* AUDIO */
init_notify(60, 3000);
#ifdef SOUND_NOTIFY
// sound_notify(prompt, self_log_in, 0, NULL);
#endif /* SOUND_NOTIFY */
const char *msg;

View File

@ -231,13 +231,13 @@ void *event_loop(void* p)
/* Actual XTRA termination
* Please call xtra_terminate() at exit
* otherwise bad stuff happens
* otherwise HEWUSAGUDBOI happens
*/
if (Xtra.display) XCloseDisplay(Xtra.display);
return (Xtra.display = NULL);
}
int xtra_init(drop_callback d)
int init_xtra(drop_callback d)
{
memset(&Xtra, 0, sizeof(Xtra));
@ -247,7 +247,7 @@ int xtra_init(drop_callback d)
XInitThreads();
if ( !(Xtra.display = XOpenDisplay(NULL))) return -1;
Xtra.terminal_window = xtra_focused_window_id();
Xtra.terminal_window = focused_window_id();
{
/* Create an invisible window which will act as proxy for the DnD operation. */
@ -317,7 +317,7 @@ int xtra_init(drop_callback d)
return 0;
}
void xtra_terminate()
void terminate_xtra()
{
if (!Xtra.display) return;
@ -337,7 +337,7 @@ void xtra_terminate()
while (Xtra.display); /* Wait for termination */
}
long unsigned int xtra_focused_window_id()
long unsigned int focused_window_id()
{
if (!Xtra.display) return 0;
@ -349,7 +349,7 @@ long unsigned int xtra_focused_window_id()
return focus;
}
int xtra_is_this_focused()
int is_focused()
{
return Xtra.proxy_window == xtra_focused_window_id();
return Xtra.proxy_window == focused_window_id();
}

View File

@ -11,9 +11,9 @@ DropType;
typedef void (*drop_callback) (const char*, DropType);
int xtra_init(drop_callback d);
void xtra_terminate();
long unsigned int xtra_focused_window_id();
int xtra_is_this_focused(); /* returns bool */
int init_xtra(drop_callback d);
void terminate_xtra();
long unsigned int focused_window_id();
int is_focused(); /* returns bool */
#endif /* XTRA_H */