aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/be_resources.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src/be_resources.cc')
-rw-r--r--lib-src/be_resources.cc39
1 files changed, 36 insertions, 3 deletions
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
index d18fe30dd7a..414f91a192d 100644
--- a/lib-src/be_resources.cc
+++ b/lib-src/be_resources.cc
@@ -29,6 +29,9 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
29#include <Application.h> 29#include <Application.h>
30#include <Catalog.h> 30#include <Catalog.h>
31#include <Roster.h> 31#include <Roster.h>
32#include <Bitmap.h>
33#include <Rect.h>
34#include <View.h>
32 35
33using namespace std; 36using namespace std;
34 37
@@ -79,11 +82,25 @@ main (int argc, char **argv)
79 BApplication app ("application/x-vnd.GNU-emacs-resource-helper"); 82 BApplication app ("application/x-vnd.GNU-emacs-resource-helper");
80 BFile file; 83 BFile file;
81 BBitmap *icon; 84 BBitmap *icon;
85 BBitmap scale32 (BRect (0, 0, 31, 31), B_RGBA32, true);
86 BBitmap scale16 (BRect (0, 0, 15, 15), B_RGBA32, true);
82 BAppFileInfo info; 87 BAppFileInfo info;
83 status_t code; 88 status_t code;
84 struct version_info vinfo; 89 struct version_info vinfo;
85 char *v = strdup (PACKAGE_VERSION); 90 char *v = strdup (PACKAGE_VERSION);
86 91
92 if (scale32.InitCheck () != B_OK
93 || scale16.InitCheck () != B_OK)
94 {
95 fprintf (stderr, "Bitmap initialization ran out of memory\n");
96 return EXIT_FAILURE;
97 }
98
99 BView scale32view (scale32.Bounds (), NULL,
100 B_FOLLOW_NONE, B_WILL_DRAW);
101 BView scale16view (scale16.Bounds (), NULL,
102 B_FOLLOW_NONE, B_WILL_DRAW);
103
87 if (argc != 3) 104 if (argc != 3)
88 { 105 {
89 printf ("be-resources ICON FILE: make FILE appropriate for Emacs.\n"); 106 printf ("be-resources ICON FILE: make FILE appropriate for Emacs.\n");
@@ -117,8 +134,24 @@ main (int argc, char **argv)
117 return EXIT_FAILURE; 134 return EXIT_FAILURE;
118 } 135 }
119 136
120 info.SetIcon (icon, B_MINI_ICON); 137 scale32.AddChild (&scale32view);
121 info.SetIcon (icon, B_LARGE_ICON); 138 scale16.AddChild (&scale16view);
139
140 if (!scale32view.LockLooper ()
141 || !scale16view.LockLooper ())
142 {
143 fprintf (stderr, "Failed to lock bitmap looper\n");
144 return EXIT_FAILURE;
145 }
146
147 scale32view.DrawBitmapAsync (icon, scale32.Bounds ());
148 scale16view.DrawBitmapAsync (icon, scale16.Bounds ());
149
150 scale32view.Sync ();
151 scale16view.Sync ();
152
153 info.SetIcon (&scale16, B_MINI_ICON);
154 info.SetIcon (&scale32, B_LARGE_ICON);
122 info.SetSignature ("application/x-vnd.GNU-emacs"); 155 info.SetSignature ("application/x-vnd.GNU-emacs");
123 156
124 v = strtok (v, "."); 157 v = strtok (v, ".");
@@ -140,5 +173,5 @@ main (int argc, char **argv)
140 173
141 info.SetVersionInfo (&vinfo, B_APP_VERSION_KIND); 174 info.SetVersionInfo (&vinfo, B_APP_VERSION_KIND);
142 175
143 return EXIT_SUCCESS; 176 exit (EXIT_SUCCESS);
144} 177}