mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:03:27 +01:00
Some random fixups
This commit is contained in:
parent
c825adc1e3
commit
2cc261c619
@ -119,7 +119,7 @@ static bool notifications_are_disabled(uint64_t flags)
|
|||||||
{
|
{
|
||||||
bool res = flags & NT_RESTOL && Control.cooldown > get_unix_time();
|
bool res = flags & NT_RESTOL && Control.cooldown > get_unix_time();
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
return res || (flags & NT_NOFOCUS && xtra_is_this_focused());
|
return res || (flags & NT_NOFOCUS && is_focused());
|
||||||
#else
|
#else
|
||||||
return res;
|
return res;
|
||||||
#endif
|
#endif
|
||||||
|
17
src/toxic.c
17
src/toxic.c
@ -128,15 +128,20 @@ void exit_toxic_success(Tox *m)
|
|||||||
free(BLOCK_FILE);
|
free(BLOCK_FILE);
|
||||||
free(user_settings);
|
free(user_settings);
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
|
||||||
// sound_notify(NULL, self_log_out, NT_ALWAYS, NULL);
|
|
||||||
#endif /* SOUND_NOTIFY */
|
|
||||||
terminate_notify();
|
terminate_notify();
|
||||||
#ifdef AUDIO
|
#ifdef AUDIO
|
||||||
terminate_audio();
|
terminate_audio();
|
||||||
#endif /* AUDIO */
|
#endif /* AUDIO */
|
||||||
|
|
||||||
tox_kill(m);
|
tox_kill(m);
|
||||||
endwin();
|
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);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,7 +1015,7 @@ int main(int argc, char *argv[])
|
|||||||
int settings_err = settings_load(user_settings, p);
|
int settings_err = settings_load(user_settings, p);
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
xtra_init(cb);
|
init_xtra(cb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Tox *m = init_tox();
|
Tox *m = init_tox();
|
||||||
@ -1056,10 +1061,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
init_notify(60, 3000);
|
init_notify(60, 3000);
|
||||||
|
|
||||||
#ifdef SOUND_NOTIFY
|
|
||||||
// sound_notify(prompt, self_log_in, 0, NULL);
|
|
||||||
#endif /* SOUND_NOTIFY */
|
|
||||||
|
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
if (config_err) {
|
if (config_err) {
|
||||||
|
14
src/xtra.c
14
src/xtra.c
@ -231,13 +231,13 @@ void *event_loop(void* p)
|
|||||||
|
|
||||||
/* Actual XTRA termination
|
/* Actual XTRA termination
|
||||||
* Please call xtra_terminate() at exit
|
* Please call xtra_terminate() at exit
|
||||||
* otherwise bad stuff happens
|
* otherwise HEWUSAGUDBOI happens
|
||||||
*/
|
*/
|
||||||
if (Xtra.display) XCloseDisplay(Xtra.display);
|
if (Xtra.display) XCloseDisplay(Xtra.display);
|
||||||
return (Xtra.display = NULL);
|
return (Xtra.display = NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int xtra_init(drop_callback d)
|
int init_xtra(drop_callback d)
|
||||||
{
|
{
|
||||||
memset(&Xtra, 0, sizeof(Xtra));
|
memset(&Xtra, 0, sizeof(Xtra));
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ int xtra_init(drop_callback d)
|
|||||||
XInitThreads();
|
XInitThreads();
|
||||||
if ( !(Xtra.display = XOpenDisplay(NULL))) return -1;
|
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. */
|
/* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtra_terminate()
|
void terminate_xtra()
|
||||||
{
|
{
|
||||||
if (!Xtra.display) return;
|
if (!Xtra.display) return;
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ void xtra_terminate()
|
|||||||
while (Xtra.display); /* Wait for termination */
|
while (Xtra.display); /* Wait for termination */
|
||||||
}
|
}
|
||||||
|
|
||||||
long unsigned int xtra_focused_window_id()
|
long unsigned int focused_window_id()
|
||||||
{
|
{
|
||||||
if (!Xtra.display) return 0;
|
if (!Xtra.display) return 0;
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ long unsigned int xtra_focused_window_id()
|
|||||||
return focus;
|
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();
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ DropType;
|
|||||||
|
|
||||||
typedef void (*drop_callback) (const char*, DropType);
|
typedef void (*drop_callback) (const char*, DropType);
|
||||||
|
|
||||||
int xtra_init(drop_callback d);
|
int init_xtra(drop_callback d);
|
||||||
void xtra_terminate();
|
void terminate_xtra();
|
||||||
long unsigned int xtra_focused_window_id();
|
long unsigned int focused_window_id();
|
||||||
int xtra_is_this_focused(); /* returns bool */
|
int is_focused(); /* returns bool */
|
||||||
|
|
||||||
#endif /* XTRA_H */
|
#endif /* XTRA_H */
|
Loading…
Reference in New Issue
Block a user