Skip to content

Commit 82e9bac

Browse files
committed
Clang format, new standards
1 parent d1b89e2 commit 82e9bac

File tree

11 files changed

+20
-159
lines changed

11 files changed

+20
-159
lines changed

src/hotkey/api_hotkey.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#ifndef _X_HOTKEY_H_INCLUDED
2929
#define _X_HOTKEY_H_INCLUDED
@@ -59,7 +59,8 @@ class Hotkey
5959
static void add_hotkey(HotkeyConfiguration ** pphotkey, OS_KeySym keysym,
6060
int mask, int type, EVENT event);
6161
static void key_to_string(int key, char ** out_keytext);
62-
static char* create_human_readable_keytext(const char* const keytext, int key, int mask);
62+
static char * create_human_readable_keytext(const char * const keytext,
63+
int key, int mask);
6364
};
6465

6566
#ifndef _WIN32

src/hotkey/grab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#ifndef _GRAB_H_INCLUDED_
2929
#define _GRAB_H_INCLUDED_

src/hotkey/gui.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ static gboolean on_entry_key_press_event(GtkWidget * widget,
129129

130130
Hotkey::set_keytext(controls->keytext, is_mod ? 0 : event->hardware_keycode,
131131
mod, TYPE_KEY);
132-
// Returning TRUE indicates that the event has been handled, and that it should not propagate further.
132+
// Returning TRUE indicates that the event has been handled, and that it
133+
// should not propagate further.
133134
return true;
134135
}
135136

src/hotkey/gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#ifndef _GUI_H_INCLUDED_
2929
#define _GUI_H_INCLUDED_

src/hotkey/hotkey_api_common.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#include "api_hotkey.h"
2929
#include <X11/X.h>

src/hotkey/plugin.cc

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
#include "grab.h"
4848
#include "gui.h"
4949

50-
#ifdef BUILT_FROM_CMAKE
51-
#include "../../audacious-plugins_simpleAF/src/thirdparty/d_custom_logger.hpp"
52-
#endif
53-
5450
extern bool system_up_and_running;
5551

5652
class GlobalHotkeys : public GeneralPlugin
@@ -91,9 +87,6 @@ PluginConfig * get_config() { return &plugin_cfg_gtk_global_hk; }
9187
*/
9288
bool GlobalHotkeys::init()
9389
{
94-
#ifdef BUILT_FROM_CMAKE
95-
audlog::subscribe(&DCustomLogger::go, audlog::Level::Debug);
96-
#endif
9790
if (!gtk_init_check(nullptr, nullptr))
9891
{
9992
AUDERR("GTK+ initialization failed.\n");
@@ -305,19 +298,11 @@ void load_defaults()
305298
Hotkey::add_hotkey(&hotkey, OS_KEY_AudioStop, 0, TYPE_KEY, EVENT_STOP);
306299
Hotkey::add_hotkey(&hotkey, OS_KEY_AudioNext, 0, TYPE_KEY,
307300
EVENT_NEXT_TRACK);
308-
309-
/* add_hotkey(&hotkey, OS_KEY_AudioRewind, 0, TYPE_KEY, EVENT_BACKWARD);
310-
*/
311-
312301
Hotkey::add_hotkey(&hotkey, OS_KEY_AudioMute, 0, TYPE_KEY, EVENT_MUTE);
313302
Hotkey::add_hotkey(&hotkey, OS_KEY_AudioRaiseVolume, 0, TYPE_KEY,
314303
EVENT_VOL_UP);
315304
Hotkey::add_hotkey(&hotkey, OS_KEY_AudioLowerVolume, 0, TYPE_KEY,
316305
EVENT_VOL_DOWN);
317-
318-
/* add_hotkey(&hotkey, OS_KEY_AudioMedia, 0, TYPE_KEY,
319-
EVENT_JUMP_TO_FILE); add_hotkey(&hotkey, XF86XK_Music, 0, TYPE_KEY,
320-
EVENT_TOGGLE_WIN); */
321306
}
322307

323308
/* load plugin configuration */
@@ -410,10 +395,6 @@ void GlobalHotkeys::cleanup()
410395
{
411396
#ifdef _WIN32
412397
system_up_and_running = false;
413-
#endif
414-
#ifdef BUILT_FROM_CMAKE
415-
AUDWARN("Cleanup of globalHotkeys");
416-
audlog::unsubscribe(&DCustomLogger::go);
417398
#endif
418399
HotkeyConfiguration * hotkey;
419400
ungrab_keys();

src/hotkey/x_hotkey.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#include <X11/X.h>
2929
#include <X11/XKBlib.h>
@@ -76,7 +76,8 @@ void Hotkey::key_to_string(int key, char ** out_keytext)
7676
}
7777
}
7878

79-
char* Hotkey::create_human_readable_keytext(const char* const keytext, int key, int mask)
79+
char * Hotkey::create_human_readable_keytext(const char * const keytext,
80+
int key, int mask)
8081
{
8182
static const constexpr unsigned int modifiers[] = {
8283
HK_CONTROL_MASK, HK_SHIFT_MASK, HK_MOD1_ALT_MASK, HK_MOD2_MASK,

src/hotkeyw32/w32_hotkey.cc

Lines changed: 4 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#include <src/hotkey/api_hotkey.h>
2929

@@ -92,9 +92,6 @@ void Hotkey::add_hotkey(HotkeyConfiguration ** pphotkey,
9292
photkey = *pphotkey;
9393
if (photkey == nullptr)
9494
return;
95-
// keycode =
96-
// XKeysymToKeycode(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
97-
// keysym); if (keycode == 0) return;
9895
if (photkey->key)
9996
{
10097
photkey->next = g_new(HotkeyConfiguration, 1);
@@ -119,54 +116,6 @@ void register_global_keys(HWND handle)
119116
}
120117
}
121118

122-
// void assign(wchar_t *ptr_first_element, const wchar_t *text) {
123-
// int loc = 0;
124-
// while (text[loc]) {
125-
// ptr_first_element[loc] = text[loc];
126-
// ++loc;
127-
// }
128-
// ptr_first_element[loc] = 0;
129-
//}
130-
131-
//HRESULT AddThumbarButtons(HWND hwnd)
132-
//{
133-
// // Define an array of two buttons. These buttons provide images through an
134-
// // image list and also provide tooltips.
135-
// THUMBBUTTONMASK dwMask = THB_BITMAP | THB_TOOLTIP | THB_FLAGS;
136-
//
137-
// /*
138-
// THUMBBUTTONMASK dwMask;
139-
// UINT iId;
140-
// UINT iBitmap;
141-
// HICON hIcon;
142-
// WCHAR szTip[260];
143-
// THUMBBUTTONFLAGS dwFlags;
144-
// */
145-
//
146-
// THUMBBUTTON btn[]{
147-
// {dwMask, W_KEY_ID_PREV, 0, nullptr, L"Previous song", THBF_ENABLED},
148-
// {dwMask, W_KEY_ID_PLAY, 0, nullptr, L"Play/pause", THBF_ENABLED},
149-
// {dwMask, W_KEY_ID_NEXT, 0, nullptr, L"Next song", THBF_ENABLED}};
150-
//
151-
// ITaskbarList3 * ptbl;
152-
// HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER,
153-
// IID_PPV_ARGS(&ptbl));
154-
//
155-
// if (SUCCEEDED(hr))
156-
// {
157-
// // Declare the image list that contains the button images.
158-
// // hr = ptbl->ThumbBarSetImageList(hwnd, himl);
159-
//
160-
// if (SUCCEEDED(hr))
161-
// {
162-
// // Attach the toolbar to the thumbnail.
163-
// hr = ptbl->ThumbBarAddButtons(hwnd, ARRAYSIZE(btn), btn);
164-
// }
165-
// ptbl->Release();
166-
// }
167-
// return hr;
168-
//}
169-
170119
GdkFilterReturn w32_events_filter_first_everything(GdkXEvent * gdk_xevent,
171120
GdkEvent * event,
172121
gpointer user_data)
@@ -188,8 +137,7 @@ GdkFilterReturn w32_events_filter_first_everything(GdkXEvent * gdk_xevent,
188137
(static_cast<std::string>(event_window)).c_str());
189138
if (event_window.is_main_window(true))
190139
{
191-
event_window.
192-
WindowsWindow::main_window_hidden_ = false;
140+
event_window.WindowsWindow::main_window_hidden_ = false;
193141
AUDDBG(
194142
"TRANSFER EventReceivingWindow from %s to mainwindow HWND "
195143
"%p",
@@ -200,32 +148,6 @@ GdkFilterReturn w32_events_filter_first_everything(GdkXEvent * gdk_xevent,
200148
grab_keys_onto_window();
201149
}
202150
}
203-
// else
204-
// {
205-
// // leaving us.
206-
// AUDDBG("(GettingDown)FALSE %s; %s",
207-
// stringify_win_evt(msg->message).c_str(),
208-
// (static_cast<std::string>(event_window)).c_str());
209-
// }
210-
}
211-
// else if (msg->message == WM_CLOSE)
212-
// {
213-
// auto event_window = WindowsWindow::get_window_data(msg->hwnd);
214-
// AUDDBG("%s: ; %s", stringify_win_evt(msg->message).c_str(),
215-
// (static_cast<std::string>(event_window)).c_str());
216-
// }
217-
// else if (msg->message == WM_CREATE)
218-
// {
219-
// auto event_window = WindowsWindow::get_window_data(msg->hwnd);
220-
// AUDDBG("%s: ; %s", stringify_win_evt(msg->message).c_str(),
221-
// (static_cast<std::string>(event_window)).c_str());
222-
// }
223-
// else if (msg->message == WM_DESTROY)
224-
// {
225-
// auto event_window = WindowsWindow::get_window_data(msg->hwnd);
226-
// AUDDBG("%s: ; %s", stringify_win_evt(msg->message).c_str(),
227-
// (static_cast<std::string>(event_window)).c_str());
228-
// }
229151
return GDK_FILTER_CONTINUE;
230152
}
231153

@@ -310,50 +232,7 @@ void release_filter()
310232
w32_evts_filter, nullptr);
311233
message_receiving_window = nullptr;
312234
}
313-
//
314-
// void main_window_created_from_statusbar(
315-
// MainWindowSearchFilterData * const passed_data,
316-
// WindowsWindow & created_main_window)
317-
//{
318-
// // When window fully shows, must add windows buttons.
319-
// gdk_window_remove_filter(
320-
// reinterpret_cast<GdkWindow *>(passed_data->window_),
321-
// reinterpret_cast<GdkFilterFunc>(passed_data->function_ptr_),
322-
// passed_data);
323-
// ungrab_keys();
324-
// release_filter();
325-
// delete passed_data;
326-
//}
327-
//
328-
// GdkFilterReturn main_window_missing_filter(GdkXEvent * gdk_xevent,
329-
// GdkEvent * event, gpointer
330-
// user_data)
331-
//{
332-
// auto msg = reinterpret_cast<MSG *>(gdk_xevent);
333-
// if (msg->message == WM_SHOWWINDOW && msg->wParam)
334-
// {
335-
// auto win_data = WindowsWindow::get_window_data(msg->hwnd);
336-
// if (win_data.is_main_window())
337-
// {
338-
// main_window_created_from_statusbar(
339-
// reinterpret_cast<MainWindowSearchFilterData *>(user_data),
340-
// win_data);
341-
// }
342-
// }
343-
// return GDK_FILTER_CONTINUE;
344-
//}
345235

346-
/**
347-
* GSourceFunc:
348-
* @user_data: data passed to the function, set when the source was
349-
* created with one of the above functions
350-
*
351-
* Specifies the type of function passed to g_timeout_add(),
352-
* g_timeout_add_full(), g_idle_add(), and g_idle_add_full().
353-
*
354-
* Returns: %FALSE if the source should be removed. #G_SOURCE_CONTINUE and
355-
* #G_SOURCE_REMOVE are more memorable names for the return value.
356-
*/
357236
gboolean window_created_callback(gpointer user_data)
358237
{
359238
AUDDBG("Window created. Do real stuff.");
@@ -363,10 +242,7 @@ gboolean window_created_callback(gpointer user_data)
363242
return G_SOURCE_REMOVE;
364243
}
365244

366-
void win_init()
367-
{
368-
g_idle_add(&window_created_callback, nullptr);
369-
}
245+
void win_init() { g_idle_add(&window_created_callback, nullptr); }
370246

371247
void Hotkey::key_to_string(int key, char ** out_keytext)
372248
{
@@ -375,7 +251,7 @@ void Hotkey::key_to_string(int key, char ** out_keytext)
375251
switch (key)
376252
{
377253
case VK_OEM_NEC_EQUAL:
378-
// case VK_OEM_FJ_JISHO: (note: same as EQUAL)
254+
// case VK_OEM_FJ_JISHO: (note: same as EQUAL)
379255
case VK_OEM_FJ_MASSHOU:
380256
case VK_OEM_FJ_TOUROKU:
381257
case VK_OEM_FJ_LOYA:

src/hotkeyw32/windows_key_str_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#ifndef AUDACIOUS_PLUGINS_WINDOWS_KEY_STRINGS_HPP
2929
#define AUDACIOUS_PLUGINS_WINDOWS_KEY_STRINGS_HPP

src/hotkeyw32/windows_window.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* The Audacious team does not consider modular code linking to
2525
* Audacious or using our public API to be a derived work.
26-
*/
26+
*/
2727

2828
#include "windows_window.h"
2929

0 commit comments

Comments
 (0)