Skip to content

Commit 3042413

Browse files
committed
Applying patches from Michael to fix openbsd buils. Fixing notification daemon to properly read 'replaces' property.
1 parent 29475da commit 3042413

File tree

12 files changed

+155
-50
lines changed

12 files changed

+155
-50
lines changed

data/pekwm/scripts/Jamfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
SubDir TOP data pekwm scripts ;
1212

13-
InstallProgram "$(PEKWM_DATA_DIR)/scripts" : pekwm_themeset.sh pekwm_ws_menu.sh ;
13+
# InstallProgram "$(PEKWM_DATA_DIR)/scripts" : pekwm_themeset.sh pekwm_ws_menu.sh ;

ede-about/ede-about.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,25 @@ const char* bold_keywords[] = {
102102

103103
#define BOLD_KEYWORDS_LEN 8
104104

105-
void close_cb(Fl_Widget*, void*) {
105+
static void close_cb(Fl_Widget*, void*) {
106106
win->hide();
107107
}
108108

109-
char* prepare_style(char* txt, int len) {
109+
static char* prepare_style(char* txt, int len) {
110110
// paint all with 'A' style at startup
111111
char* style = new char[len + 1];
112112
memset(style, 'A', len - 1);
113113
style[len] = '\0';
114114

115115
// find bold keywords and paint them
116116
char* p = 0;
117+
unsigned int ln;
117118
for(int i = 0; i < BOLD_KEYWORDS_LEN; i++) {
118119
p = strstr(txt, bold_keywords[i]);
119-
if(!p)
120-
continue;
121-
unsigned int len = strlen(bold_keywords[i]);
122-
memset(&style[p - txt], 'B', len);
120+
if(!p) continue;
121+
122+
ln = strlen(bold_keywords[i]);
123+
memset(&style[p - txt], 'B', ln);
123124
}
124125

125126
return style;

ede-bug-tools/ede-bug-report/Jamfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ if $(CURL_CFLAGS) || $(CURL_LIBS) {
9999
curlmulti.c
100100
lock_pthread.c ;
101101

102-
ObjectCcFlags $(CURL_TRANSPORT_SRC) : $(CURL_CFLAGS) ;
102+
ObjectCcFlags $(CURL_TRANSPORT_SRC) : $(XMLRPC_C_FLAGS) $(CURL_CFLAGS) ;
103103

104104
UTIL_SRC =
105105
casprintf.c

ede-desktop/Desktop.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ DesktopIcon *Desktop::read_desktop_file(const char *path, const char *base, Desk
421421
return ret;
422422
}
423423

424-
425424
void Desktop::arrange_icons(void) {
426425
int lw = icon_opts ? icon_opts->label_maxwidth : 75;
427426
int X = (lw / 5) + 10;

ede-desktop/Jamfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ SOURCE = ede-desktop.cpp
3131

3232
ObjectC++Flags $(SOURCE) : $(EDELIB_DBUS_INCLUDE) ;
3333
EdeProgram ede-desktop : $(SOURCE) ;
34-
LinkAgainst ede-desktop : $(EDELIB_DBUS_LIB) $(XSHAPE_LIBS) ;
34+
LinkAgainst ede-desktop : $(EDELIB_DBUS_LIB) $(XSHAPE_LIBS) $(PTHREAD_LIBS) ;

ede-notify-daemon/Jamfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SubDir TOP ede-notify-daemon ;
1313
SOURCE = ede-notify-daemon.cpp NotifyWindow.cpp ;
1414

1515
EdeProgram ede-notify-daemon : $(SOURCE) ;
16-
LinkAgainst ede-notify-daemon : $(EDELIB_DBUS_LIB) ;
16+
LinkAgainst ede-notify-daemon : $(EDELIB_DBUS_LIB) $(PTHREAD_LIBS) ;
1717

1818
TranslationStrings locale : $(SOURCE) ;
1919

ede-notify-daemon/NotifyWindow.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ void NotifyWindow::set_icon(const char *img) {
115115
}
116116

117117
void NotifyWindow::set_body(const char *s) {
118-
summary->resize(summary->x(), summary->y() - (summary->h() / 2), summary->w(), summary->h());
118+
summary->resize(65, 10, 185, 25);
119+
//summary->resize(summary->x(), summary->y() - (summary->h() / 2), summary->w(), summary->h());
119120

120121
body->value(s);
121122
body->show();
@@ -137,7 +138,7 @@ void NotifyWindow::resize(int X, int Y, int W, int H) {
137138
* do not call further if window is shown: different strategy is needed as every time
138139
* window is re-configured, this will be called
139140
*/
140-
if(shown()) return;
141+
//if(shown()) return;
141142

142143
/* resize summary if needed */
143144
if(summary->size() > 0) {

ede-notify-daemon/NotifyWindow.h

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* $Id: ede-panel.cpp 3330 2012-05-28 10:57:50Z karijes $
33
*
4-
* Copyright (C) 2012 Sanel Zukan
4+
* Copyright (C) 2012-2014 Sanel Zukan
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU General Public License
@@ -31,7 +31,8 @@
3131

3232
class NotifyWindow : public Fl_Window {
3333
private:
34-
int id, exp, timer_set;
34+
unsigned int id;
35+
int exp, timer_set;
3536
Fl_Button *closeb;
3637
Fl_Box *imgbox;
3738
Fl_Multiline_Output *summary, *body;
@@ -41,8 +42,8 @@ class NotifyWindow : public Fl_Window {
4142
public:
4243
NotifyWindow();
4344

44-
void set_id(int i) { id = i; }
45-
int get_id(void) { return id; }
45+
void set_id(unsigned int i) { id = i; }
46+
unsigned int get_id(void) { return id; }
4647

4748
void set_icon(const char *img);
4849
void set_summary(const char *s) { summary->value(s); }
@@ -52,7 +53,14 @@ class NotifyWindow : public Fl_Window {
5253
* match to spec: if is -1, then we handle it, if is 0, then window will not be closed and
5354
* the rest is sender specific
5455
*/
55-
void set_expire(int t) { exp = t; }
56+
void set_expire(int t, bool update_timer) {
57+
exp = t;
58+
// if(update_timer) {
59+
// remove_timeout();
60+
// add_timeout();
61+
// }
62+
}
63+
5664
void show(void);
5765

5866
virtual void resize(int X, int Y, int W, int H);

ede-notify-daemon/ede-notify-daemon.cpp

+56-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* $Id: ede-panel.cpp 3330 2012-05-28 10:57:50Z karijes $
33
*
4-
* Copyright (C) 2012 Sanel Zukan
4+
* Copyright (C) 2012-2014 Sanel Zukan
55
*
66
* This program is free software; you can redistribute it and/or
77
* modify it under the terms of the GNU General Public License
@@ -83,7 +83,8 @@ static bool server_running;
8383
* list of server capabilities
8484
* check all available on: http://people.gnome.org/~mccann/docs/notification-spec/notification-spec-latest.html
8585
*/
86-
static const char *server_caps[] = {"actions", "body", "icon-static", 0};
86+
// static const char *server_caps[] = {"actions", "body", "icon-static", 0};
87+
static const char *server_caps[] = {"body", "icon-static", 0};
8788

8889
/* increased every time new notification window is shown; must be less than UINT_MAX */
8990
static unsigned int notify_id;
@@ -128,22 +129,40 @@ static bool get_int_coordinate(const char *n, EdbusDict &hints, int &c) {
128129
return true;
129130
}
130131

131-
static void show_window(unsigned int id,
132-
const char *app_name,
133-
const char *app_icon,
134-
const char *summary,
135-
const char *body,
136-
int expire_timeout,
137-
EdbusDict &hints)
132+
static void show_or_update_window(bool update_only,
133+
unsigned int id,
134+
const char *app_name,
135+
const char *app_icon,
136+
const char *summary,
137+
const char *body,
138+
int expire_timeout,
139+
EdbusDict &hints)
138140
{
139141
byte_t u = get_urgency_level(hints);
142+
NotifyWindow *win = NULL;
140143

141-
NotifyWindow *win = new NotifyWindow();
144+
if(update_only) {
145+
E_DEBUG(E_STRLOC ": Requesting update\n");
146+
/* try to find existing window with given id */
147+
Fl_Window *wi;
148+
NotifyWindow *tmp;
149+
150+
for(wi = Fl::first_window(); wi; wi = Fl::next_window(wi)) {
151+
if(wi->type() != NOTIFYWINDOW_TYPE) continue;
152+
tmp = (NotifyWindow*)wi;
153+
if(tmp->get_id() == id) {
154+
E_DEBUG(E_STRLOC ": Requesting update - win found\n");
155+
win = tmp;
156+
break;
157+
}
158+
}
159+
}
160+
161+
/* window not found or new window requested */
162+
if(!win) win = new NotifyWindow();
142163

143-
if(!empty_str(summary))
144-
win->set_summary(summary);
145-
if(!empty_str(body))
146-
win->set_body(body);
164+
if(!empty_str(summary)) win->set_summary(summary);
165+
if(!empty_str(body)) win->set_body(body);
147166
if(empty_str(app_icon)) {
148167
switch(u) {
149168
case URGENCY_CRITICAL:
@@ -158,7 +177,7 @@ static void show_window(unsigned int id,
158177

159178
win->set_icon(app_icon);
160179
win->set_id(id);
161-
win->set_expire(expire_timeout);
180+
win->set_expire(expire_timeout, update_only);
162181

163182
/* according to spec, both coordinates must exist so window can be positioned as desired */
164183
int X, Y;
@@ -198,7 +217,8 @@ static void show_window(unsigned int id,
198217
}
199218

200219
/* we are already running loop, so window will handle events */
201-
win->show();
220+
if(!win->shown())
221+
win->show();
202222
}
203223

204224
static int handle_notify(EdbusConnection *dbus, const EdbusMessage *m) {
@@ -209,7 +229,7 @@ static int handle_notify(EdbusConnection *dbus, const EdbusMessage *m) {
209229

210230
const char *app_name, *app_icon, *summary, *body;
211231
app_name = app_icon = summary = body = NULL;
212-
unsigned int replaces_id;
232+
unsigned int replaces_id, id;
213233
int expire_timeout;
214234

215235
EdbusMessage::const_iterator it = m->begin();
@@ -246,19 +266,33 @@ static int handle_notify(EdbusConnection *dbus, const EdbusMessage *m) {
246266
E_RETURN_VAL_IF_FAIL(it->is_int32(), 0);
247267
expire_timeout = it->to_int32();
248268

249-
/* specification dumb stuff: what if we got UINT_MAX?? here we will reverse to first ID */
250-
if(++notify_id == UINT_MAX) notify_id = 1;
269+
if(replaces_id > 0) {
270+
id = replaces_id;
271+
} else {
272+
/* by the spec, if we got MAX, reversing will be just fine */
273+
if(++notify_id == UINT_MAX) notify_id = 1;
274+
id = notify_id;
275+
}
251276

277+
/* this should never happen */
278+
E_RETURN_VAL_IF_FAIL(id != 0, 0);
279+
280+
show_or_update_window(replaces_id > 0, id,
281+
app_name, app_icon, summary, body, expire_timeout, hints);
282+
#if 0
252283
if(replaces_id) {
253-
//replaces_id == notify_id;
284+
update_window(replaces_id, app_name, app_icon, summary, body, expire_timeout, hints);
285+
sent_id = replaces_id;
254286
} else {
255287
show_window(notify_id, app_name, app_icon, summary, body, expire_timeout, hints);
288+
sent_id = notify_id;
256289
}
290+
#endif
257291

258-
/* reply sent to client */
292+
/* reply sent to client, with used window id */
259293
EdbusMessage reply;
260294
reply.create_reply(*m);
261-
reply << EdbusData::from_uint32(replaces_id);
295+
reply << EdbusData::from_uint32(id);
262296
dbus->send(reply);
263297

264298
return 1;
@@ -357,7 +391,6 @@ int main(int argc, char **argv) {
357391

358392
dbus.register_object(NOTIFICATIONS_DBUS_PATH);
359393
dbus.method_callback(notifications_dbus_method_cb, &dbus);
360-
//dbus.signal_callback(notifications_dbus_signal_cb, &dbus);
361394
dbus.setup_listener_with_fltk();
362395
server_running = true;
363396

ede-notify-daemon/test-notifications.sh

+60-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,64 @@
33

44
N_EVENTS=5
55

6-
notify_cmd="notify-send --expire-time=10000"
6+
#notify_cmd="notify-send --expire-time=3000"
7+
#
8+
#for((i=0;i<$N_EVENTS;i++)) do
9+
# $notify_cmd "title $i" "this is content"
10+
#done
711

8-
for((i=0;i<$N_EVENTS;i++)) do
9-
$notify_cmd "title $i" "this is content"
10-
done
12+
#method call sender=:1.798 -> dest=org.freedesktop.Notifications serial=116 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
13+
# string "Mumble"
14+
# uint32 1
15+
# string "gtk-dialog-info"
16+
# string "User Joined Channel"
17+
# string "<a href='clientid://df93eabe004245bd18dd38cf9a07bd5242b2f522' class='log-user log-target'>madamova</a> entered channel."
18+
# array [
19+
# ]
20+
# array [
21+
# dict entry(
22+
# string "desktop-entry"
23+
# variant string "mumble"
24+
# )
25+
# ]
26+
# int32 -1
27+
28+
dbus-send --type=method_call \
29+
--dest=org.freedesktop.Notifications \
30+
/org/freedesktop/Notifications org.freedesktop.Notifications.Notify \
31+
string:"Mumble" \
32+
uint32:1 \
33+
string:"gtk-dialog-info" \
34+
string:"User Joined Channel" \
35+
string:"<a href='clientid://df93eabe004245bd18dd38cf9a07bd5242b2f522' class='log-user log-target'>madamova</a> entered channel." \
36+
array:string:'' \
37+
dict:string:string:'','' \
38+
int32:-1
39+
40+
sleep 1
41+
42+
dbus-send --type=method_call \
43+
--dest=org.freedesktop.Notifications \
44+
/org/freedesktop/Notifications org.freedesktop.Notifications.Notify \
45+
string:"Mumble 2" \
46+
uint32:1 \
47+
string:"gtk-dialog-info" \
48+
string:"User Joined Channel #2" \
49+
string:"<a href='clientid://df93eabe004245bd18dd38cf9a07bd5242b2f522' class='log-user log-target'>madamova</a> entered channel. asdasd asdasdsa asdasd asdasd asdasdsa" \
50+
array:string:'' \
51+
dict:string:string:'','' \
52+
int32:-1
53+
54+
sleep 1
55+
56+
dbus-send --type=method_call \
57+
--dest=org.freedesktop.Notifications \
58+
/org/freedesktop/Notifications org.freedesktop.Notifications.Notify \
59+
string:"Mumble 2" \
60+
uint32:1 \
61+
string:"gtk-dialog-info" \
62+
string:"User Joined Channel #2 dasdasd asdasfdsa fsdfsdfa sdfsdfasdf asdfsdfasdfasdfasdfa asdfasdfdsafasdfasdfdsafdsaf sadfsdafds" \
63+
string:"doh!" \
64+
array:string:'' \
65+
dict:string:string:'','' \
66+
int32:-1

ede-panel/applets/cpu-monitor/CpuMonitor.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@
3636
# include <string.h> /* strncmp */
3737
#endif
3838

39-
#ifdef __FreeBSD__
39+
#if defined(__FreeBSD__) || defined(__OpenBSD__)
4040
# include <sys/param.h>
4141
# include <sys/sysctl.h>
42-
# if __FreeBSD_version < 500101
43-
# include <sys/dkstat.h>
42+
# if defined(__OpenBSD__)
43+
# include <sys/sched.h>
4444
# else
45-
# include <sys/resource.h>
45+
# if __FreeBSD_version < 500101
46+
# include <sys/dkstat.h>
47+
# else
48+
# include <sys/resource.h>
49+
# endif
4650
# endif
4751
# include <sys/stat.h>
4852
#endif

evoke/EvokeService.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ EDELIB_NS_USING(EDBUS_SYSTEM)
6666
#endif
6767

6868
/* stolen from xfce's xfsm-shutdown-helper */
69-
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
69+
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
7070
# define POWEROFF_CMD "/sbin/shutdown -p now"
7171
# define REBOOT_CMD "/sbin/shutdown -r now"
72+
#elif defined(__OpenBSD__)
73+
# define POWEROFF_CMD "/sbin/shutdown -hp now"
74+
# define REBOOT_CMD "/sbin/shutdown -r now"
7275
#elif defined(sun) || defined(__sun)
7376
# define POWEROFF_CMD "/usr/sbin/shutdown -i 5 -g 0 -y"
7477
# define REBOOT_CMD "/usr/sbin/shutdown -i 6 -g 0 -y"

0 commit comments

Comments
 (0)