From eb1466cf86f1a987a3c7eecd156a05ed11d5dc92 Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Tue, 30 Sep 2008 21:48:35 +0000 Subject: [PATCH] * use the screenshot app to take a screenshot * remove libpng and libz dependency in case we build for Haiku git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27801 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/Jamfile | 10 +++++++--- src/kits/interface/Jamfile | 12 ++++++++++-- src/kits/interface/Window.cpp | 26 ++++++++++++++++++++------ 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/kits/Jamfile b/src/kits/Jamfile index cc4e878389..f5799478af 100644 --- a/src/kits/Jamfile +++ b/src/kits/Jamfile @@ -20,12 +20,17 @@ if $(RUN_WITHOUT_APP_SERVER) != 0 { UsePrivateHeaders [ FDirName kernel ] # For KMessage.h UsePrivateHeaders syslog_daemon ; # For syslog.cpp +local pngDump ; +if $(TARGET_PLATFORM) != haiku { + pngDump = libpng.so libz.so ; +} + # Build our libbe.so AddResources libbe.so : libbe_version.rdef ; SharedLibrary libbe.so : - : + : app_kit.o interface_kit.o storage_kit.o @@ -35,7 +40,7 @@ SharedLibrary libbe.so : libagg.a libroot.so # make sure it links against our libroot.so - libpng.so libz.so # For dumping the screen to PNG in the Interface Kit + $(pngDump) # For dumping the screen to PNG in the Interface Kit on R5 $(TARGET_LIBSTDC++) ; @@ -71,7 +76,6 @@ SharedLibrary libbe_haiku.so : libbeadapter.so $(TARGET_NETWORK_LIBS) - libpng.so # For dumping the screen to PNG in the Interface Kit $(TARGET_LIBSTDC++) ; diff --git a/src/kits/interface/Jamfile b/src/kits/interface/Jamfile index 3114d32e93..dbb2bf077a 100644 --- a/src/kits/interface/Jamfile +++ b/src/kits/interface/Jamfile @@ -26,8 +26,14 @@ if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { SetSubDirSupportedPlatforms haiku libbe_test ; UsePrivateHeaders app input print interface shared tracker ; -UseLibraryHeaders icon png zlib ; +local pngDump ; +if $(TARGET_PLATFORM) = haiku { + UseLibraryHeaders icon ; +} else { + pngDump = PNGDump.cpp ; + UseLibraryHeaders icon png zlib ; +} SEARCH_SOURCE += [ FDirName $(SUBDIR) textview_support ] ; SEARCH_SOURCE += [ FDirName $(SUBDIR) layouter ] ; @@ -78,7 +84,6 @@ MergeObject interface_kit.o : PictureButton.cpp PictureDataWriter.cpp PicturePlayer.cpp - PNGDump.cpp Point.cpp Polygon.cpp PopUpMenu.cpp @@ -126,6 +131,9 @@ MergeObject interface_kit.o : LayoutOptimizer.cpp OneElementLayouter.cpp SimpleLayouter.cpp + + # required on R5 + $(pngDump) ; StaticLibrary libcolumnlistview.a : diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index fb537158e6..5bd1d50066 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -44,8 +44,9 @@ #include #include -#include "PNGDump.h" - +#ifndef __HAIKU__ +# include "PNGDump.h" +#endif //#define DEBUG_WIN #ifdef DEBUG_WIN @@ -2663,8 +2664,8 @@ BWindow::_DequeueAll() a) it uses the _DetermineTarget() method to tell what the later target of a message will be, if no explicit target is supplied. b) it calls _UnpackMessage() and _SanitizeMessage() to duplicate the message - to all of its intended targets, and to add all fields the target would - expect in such a message. + to all of its intended targets, and to add all fields the target would + expect in such a message. This is important because the app_server sends all input events to the preferred handler, and expects them to be correctly distributed to their @@ -2876,7 +2877,7 @@ BWindow::_CreateTopView() fTopView->_SetOwner(this); // we can't use AddChild() because this is the top view - fTopView->_CreateSelf(); + fTopView->_CreateSelf(); STRACE(("BuildTopView ended\n")); } @@ -3296,6 +3297,19 @@ BWindow::_HandleKeyDown(BMessage* event) // Check for Print Screen int32 rawKey; if (event->FindInt32("key", &rawKey) == B_OK && rawKey == B_PRINT_KEY) { +#ifdef __HAIKU__ + BMessage message(B_REFS_RECEIVED); + message.AddBool("silent", true); + + if ((modifiers & B_CONTROL_KEY) != 0) + message.AddBool("window", true); + + if ((modifiers & B_SHIFT_KEY) != 0 || (modifiers & B_OPTION_KEY) != 0) + message.ReplaceBool("silent", false); + + be_roster->Launch("application/x-vnd.haiku-screenshot", &message); + return true; +#elif // Get filename BPath homePath; @@ -3328,7 +3342,7 @@ BWindow::_HandleKeyDown(BMessage* event) // Free the bitmap allocated by BScreen.GetBitmap delete screenDump; - +#endif return true; } }