xfreerdp: set icon for DesktopWindow

This commit is contained in:
Anthony Tong 2011-10-22 11:55:03 -05:00
parent 82ea77158c
commit 245a5498cc
4 changed files with 8267 additions and 0 deletions

View File

@ -85,6 +85,8 @@ if(XV_FOUND)
target_link_libraries(xfreerdp ${XV_LIBRARIES})
endif()
include_directories(${CMAKE_SOURCE_DIR}/resources)
target_link_libraries(xfreerdp freerdp-core)
target_link_libraries(xfreerdp freerdp-gdi)
target_link_libraries(xfreerdp freerdp-kbd)

View File

@ -28,6 +28,9 @@
#include <X11/extensions/shape.h>
#endif
#include "FreeRDP_Icon_256px.h"
#define xf_icon_prop FreeRDP_Icon_256px_prop
#include "xf_window.h"
/* Extended Window Manager Hints: http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html */
@ -238,6 +241,9 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
if (xfi->grab_keyboard)
input_mask |= EnterWindowMask | LeaveWindowMask;
XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32,
PropModeReplace, (uint8*) xf_icon_prop, sizeof(xf_icon_prop) / sizeof(long));
XSelectInput(xfi->display, window->handle, input_mask);
XMapWindow(xfi->display, window->handle);
}

File diff suppressed because it is too large Load Diff

64
resources/conv_to_ewm_prop.py Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/python
# Copyright 2011 Anthony Tong <atong@trustedcs.com>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
tool to preconvert an icon file to a x11 property as expected
by ewm hints spec:
width, length, [argb pixels]
"""
import PIL
import PIL.Image
import os
import sys
def usage():
print "convert_to_ewm_prop <infile> <outfile>"
return 1
def main(argv):
if len(argv) != 3:
return usage()
im = PIL.Image.open(argv[1])
fp = open(argv[2], 'w')
var_name = os.path.basename(argv[2])
if var_name.endswith('.h'):
var_name = var_name[:-2]
fp.write("static unsigned long %s_prop [] = {\n" % var_name)
fp.write(" %d, %d\n" % im.size)
i = 0
for pixel in im.getdata():
r,g,b,a = pixel
pixel = b
pixel |= g << 8
pixel |= r << 16
pixel |= a << 24
fp.write(" , %du" % pixel)
i += 1
if i % 8 == 0:
fp.write("\n")
fp.write("};\n")
if __name__ == '__main__':
sys.exit(main(sys.argv))